@strapi/strapi 5.48.0 → 5.48.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -92,14 +92,15 @@ Complete installation requirements can be found in the documentation under <a hr
92
92
 
93
93
  Strapi only supports maintenance and LTS versions of Node.js. Please refer to the <a href="https://nodejs.org/en/about/releases/">Node.js release schedule</a> for more information. NPM versions installed by default with Node.js are supported. Generally it's recommended to use yarn over npm where possible.
94
94
 
95
- | Strapi Version | Recommended | Minimum |
96
- | --------------- | ----------- | ------- |
97
- | 5.31.0 and up | 24.x | 20.x |
98
- | 5.0.0 to 5.30.1 | 20.x | 18.x |
99
- | 4.14.5 and up | 20.x | 18.x |
100
- | 4.11.0 and up | 18.x | 16.x |
101
- | 4.3.9 to 4.10.x | 18.x | 14.x |
102
- | 4.0.x to 4.3.8 | 16.x | 14.x |
95
+ | Strapi Version | Recommended | Minimum |
96
+ | ----------------- | ----------- | ------- |
97
+ | 5.48.1 and up | 24.x | 22.x |
98
+ | 5.31.0 to v5.48.0 | 24.x | 20.x |
99
+ | 5.0.0 to 5.30.1 | 20.x | 18.x |
100
+ | 4.14.5 and up | 20.x | 18.x |
101
+ | 4.11.0 and up | 18.x | 16.x |
102
+ | 4.3.9 to 4.10.x | 18.x | 14.x |
103
+ | 4.0.x to 4.3.8 | 16.x | 14.x |
103
104
 
104
105
  **Database:**
105
106
 
@@ -116,7 +117,6 @@ Database driver packages often have their own minimum versions for each version
116
117
 
117
118
  | Node Version | PostgreSQL (pg) | MySQL (mysql2) | SQLite (better-sqlite3) |
118
119
  | ------------ | --------------- | -------------- | ----------------------- |
119
- | 20 | pg@8.x | mysql2@3.x | better-sqlite3@9.4.x |
120
120
  | 22 | pg@8.x | mysql2@3.x | better-sqlite3@11.x |
121
121
  | 24 | pg@8.x | mysql2@3.x | better-sqlite3@12.x |
122
122
 
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/node/core/plugins.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC;IACb;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,KAAK,UAAU,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAuBrD,QAAA,MAAM,iBAAiB,yCAKpB,KAAK,WAAW,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,CAAC,KAAG,QACjE,OAAO,MAAM,EAAE,UAAU,CAAC,CA2D3B,CAAC;AAsBF,QAAA,MAAM,wBAAwB,YAAa,OAAO,MAAM,EAAE,UAAU,CAAC;;UApJ7D,MAAM;IACZ;;OAEG;gBACS,MAAM;IAClB;;;OAGG;UACG,MAAM;UAON,OAAO;;;UAIP,MAAM;IACZ;;OAEG;gBACS,MAAM;IAClB;;;OAGG;;UAOG,QAAQ;IA6Lf,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,CAAC;AACvD,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/node/core/plugins.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,UAAU,eAAe;IACv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uB9E,CAAC;AAEF,QAAA,MAAM,wBAAwB,QAAe,YAAY,KAAG,QAAQ,YAAY,CA0B/E,CAAC;AAMF,QAAA,MAAM,yBAAyB,WAAkB,YAAY,OAAO,YAAY,wBAQ/E,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/vite/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAQrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAmJ5D,QAAA,MAAM,uBAAuB,QAAe,YAAY,KAAG,QAAQ,YAAY,CAuB9E,CAAC;AAEF,QAAA,MAAM,wBAAwB,QAAe,YAAY,KAAG,QAAQ,YAAY,CA0B/E,CAAC;AAMF,QAAA,MAAM,yBAAyB,WAAkB,YAAY,OAAO,YAAY,wBAQ/E,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/webpack/config.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAA4C,MAAM,SAAS,CAAC;AAIlF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AA8G5D,QAAA,MAAM,wBAAwB,QAAe,YAAY,KAAG,QAAQ,aAAa,CAqDhF,CAAC;AAEF,QAAA,MAAM,uBAAuB,QAAe,YAAY,KAAG,QAAQ,aAAa,CAwC/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,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,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "5.48.0";
3
+ var version = "5.48.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.js.map
@@ -1,4 +1,4 @@
1
- var version = "5.48.0";
1
+ var version = "5.48.1";
2
2
 
3
3
  export { version };
4
4
  //# sourceMappingURL=package.json.mjs.map
@@ -11,6 +11,12 @@ var errors = require('./errors.js');
11
11
 
12
12
  const validatePackageHasStrapi = (pkg)=>'strapi' in pkg && typeof pkg.strapi === 'object' && !Array.isArray(pkg.strapi) && pkg.strapi !== null;
13
13
  const validatePackageIsPlugin = (pkg)=>validatePackageHasStrapi(pkg) && pkg.strapi.kind === 'plugin';
14
+ const isPluginConfigEnabled = (config)=>{
15
+ if (typeof config === 'boolean') {
16
+ return config;
17
+ }
18
+ return config.enabled !== false;
19
+ };
14
20
  const getEnabledPlugins = async ({ cwd, logger, runtimeDir, strapi })=>{
15
21
  const plugins = {};
16
22
  /**
@@ -19,6 +25,8 @@ const getEnabledPlugins = async ({ cwd, logger, runtimeDir, strapi })=>{
19
25
  * are plugins.
20
26
  */ const deps = strapi.config.get('info.dependencies', {});
21
27
  logger.debug("Dependencies from user's project", os.EOL, deps);
28
+ const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);
29
+ logger.debug("User's plugins file", os.EOL, userPluginsFile);
22
30
  for (const dep of Object.keys(deps)){
23
31
  const pkg = await dependencies.getModule(dep, cwd);
24
32
  if (pkg && validatePackageIsPlugin(pkg)) {
@@ -28,6 +36,10 @@ const getEnabledPlugins = async ({ cwd, logger, runtimeDir, strapi })=>{
28
36
  * Unlikely to happen, but you never know.
29
37
  */ throw Error("You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!");
30
38
  }
39
+ const userPluginConfig = userPluginsFile[name];
40
+ if (userPluginConfig !== undefined && !isPluginConfigEnabled(userPluginConfig)) {
41
+ continue;
42
+ }
31
43
  plugins[name] = {
32
44
  name,
33
45
  importName: camelCase(name),
@@ -36,10 +48,14 @@ const getEnabledPlugins = async ({ cwd, logger, runtimeDir, strapi })=>{
36
48
  };
37
49
  }
38
50
  }
39
- const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);
40
- logger.debug("User's plugins file", os.EOL, userPluginsFile);
41
51
  for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)){
42
- if (userPluginConfig.enabled && userPluginConfig.resolve) {
52
+ /**
53
+ * Local plugins must be explicitly enabled to be registered, matching the
54
+ * server-side loader (`@strapi/core` get-enabled-plugins), which drops a
55
+ * `{ resolve }` declaration without a truthy `enabled`. Treating an omitted
56
+ * `enabled` as enabled here would bundle the plugin into the admin while the
57
+ * server leaves it unloaded.
58
+ */ if (typeof userPluginConfig === 'object' && userPluginConfig.enabled && userPluginConfig.resolve) {
43
59
  const sysPath = files.convertModulePathToSystemPath(userPluginConfig.resolve);
44
60
  plugins[userPluginName] = {
45
61
  name: userPluginName,
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.js","sources":["../../../../src/node/core/plugins.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport camelCase from 'lodash/camelCase';\nimport { env } from '@strapi/utils';\nimport { getModule, PackageJson } from './dependencies';\nimport { convertModulePathToSystemPath, convertSystemPathToModulePath, loadFile } from './files';\nimport type { BaseContext } from '../types';\nimport { isError } from './errors';\n\ninterface LocalPluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * The path to the plugin, relative to the app's root directory\n * in system format\n */\n path: string;\n /**\n * The path to the plugin, relative to the runtime directory\n * in module format (i.e. with forward slashes) because thats\n * where it should be used as an import\n */\n modulePath: string;\n type: 'local';\n}\n\ninterface ModulePluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * Modules don't have a path because we never resolve them to their node_modules\n * because we simply do not require it.\n */\n path?: never;\n /**\n * The path to the plugin, relative to the app's root directory\n * in module format (i.e. with forward slashes)\n */\n modulePath: string;\n type: 'module';\n}\n\ntype PluginMeta = LocalPluginMeta | ModulePluginMeta;\n\ninterface StrapiPlugin extends PackageJson {\n strapi: {\n description?: string;\n displayName?: string;\n kind: 'plugin';\n name?: string;\n required?: boolean;\n };\n}\n\nconst validatePackageHasStrapi = (\n pkg: PackageJson\n): pkg is PackageJson & { strapi: Record<string, unknown> } =>\n 'strapi' in pkg &&\n typeof pkg.strapi === 'object' &&\n !Array.isArray(pkg.strapi) &&\n pkg.strapi !== null;\n\nconst validatePackageIsPlugin = (pkg: PackageJson): pkg is StrapiPlugin =>\n validatePackageHasStrapi(pkg) && pkg.strapi.kind === 'plugin';\n\nconst getEnabledPlugins = async ({\n cwd,\n logger,\n runtimeDir,\n strapi,\n}: Pick<BaseContext, 'cwd' | 'logger' | 'strapi' | 'runtimeDir'>): Promise<\n Record<string, PluginMeta>\n> => {\n const plugins: Record<string, PluginMeta> = {};\n\n /**\n * This is the list of dependencies that are installed in the user's project.\n * It will include libraries like \"react\", so we need to collect the ones that\n * are plugins.\n */\n const deps = strapi.config.get('info.dependencies', {});\n\n logger.debug(\"Dependencies from user's project\", os.EOL, deps);\n\n for (const dep of Object.keys(deps)) {\n const pkg = await getModule(dep, cwd);\n\n if (pkg && validatePackageIsPlugin(pkg)) {\n const name = pkg.strapi.name || pkg.name;\n\n if (!name) {\n /**\n * Unlikely to happen, but you never know.\n */\n throw Error(\n \"You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!\"\n );\n }\n\n plugins[name] = {\n name,\n importName: camelCase(name),\n type: 'module',\n modulePath: dep,\n };\n }\n }\n\n const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);\n\n logger.debug(\"User's plugins file\", os.EOL, userPluginsFile);\n\n for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)) {\n if (userPluginConfig.enabled && userPluginConfig.resolve) {\n const sysPath = convertModulePathToSystemPath(userPluginConfig.resolve);\n plugins[userPluginName] = {\n name: userPluginName,\n importName: camelCase(userPluginName),\n type: 'local',\n /**\n * User plugin paths are resolved from the entry point\n * of the app, because that's how you import them.\n */\n modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, sysPath)),\n path: sysPath,\n };\n }\n }\n\n return plugins;\n};\n\nconst PLUGIN_CONFIGS = ['plugins.js', 'plugins.mjs', 'plugins.ts'];\n\ntype UserPluginConfigFile = Record<string, { enabled: boolean; resolve: string }>;\n\nconst loadUserPluginsFile = async (root: string): Promise<UserPluginConfigFile> => {\n for (const file of PLUGIN_CONFIGS) {\n const filePath = path.join(root, file);\n const configFile = await loadFile(filePath);\n\n if (configFile) {\n /**\n * Configs can be a function or they can be just an object!\n */\n return typeof configFile === 'function' ? configFile({ env }) : configFile;\n }\n }\n\n return {};\n};\n\nconst getMapOfPluginsWithAdmin = (plugins: Record<string, PluginMeta>) => {\n /**\n * This variable stores the import paths for plugins.\n * The keys are the module paths of the plugins, and the values are the paths\n * to the admin part of the plugins, which is either loaded from the\n * package.json exports or from the legacy strapi-admin.js file.\n */\n const pluginImportPaths: Record<string, string> = {};\n\n return Object.values(plugins)\n .filter((plugin) => {\n if (!plugin) {\n return false;\n }\n\n /**\n * There are two ways a plugin should be imported, either it's local to the strapi app,\n * or it's an actual npm module that's installed and resolved via node_modules.\n *\n * We first check if the plugin is local to the strapi app, using a regular `fs.existsSync` because\n * the pathToPlugin will be relative i.e. `/Users/my-name/strapi-app/src/plugins/my-plugin`.\n *\n * If the file doesn't exist well then it's probably a node_module, so instead we use `require.resolve`\n * which will resolve the path to the module in node_modules. If it fails with the specific code `MODULE_NOT_FOUND`\n * then it doesn't have an admin part to the package.\n */\n try {\n const localPluginPath = plugin.path;\n if (localPluginPath) {\n // Here we are loading a locally installed plugin\n const packageJsonPath = path.join(localPluginPath, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n const localAdminPath = packageJson?.exports?.['./strapi-admin']?.import;\n\n if (localAdminPath) {\n pluginImportPaths[plugin.modulePath] = localAdminPath;\n return true;\n }\n }\n\n // Check if legacy admin file exists in local plugin\n if (fs.existsSync(path.join(localPluginPath, 'strapi-admin.js'))) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n }\n\n // This plugin is a module, so we need to check if it has a strapi-admin export\n if (require.resolve(`${plugin.modulePath}/strapi-admin`)) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n\n return false;\n } catch (err) {\n if (\n isError(err) &&\n 'code' in err &&\n (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')\n ) {\n /**\n * the plugin does not contain FE code, so we\n * don't want to import it anyway\n */\n return false;\n }\n\n throw err;\n }\n })\n .map((plugin) => ({\n ...plugin,\n modulePath: `${plugin.modulePath}/${pluginImportPaths[plugin.modulePath]}`,\n }));\n};\n\nexport { getEnabledPlugins, getMapOfPluginsWithAdmin };\nexport type { PluginMeta, LocalPluginMeta, ModulePluginMeta };\n"],"names":["validatePackageHasStrapi","pkg","strapi","Array","isArray","validatePackageIsPlugin","kind","getEnabledPlugins","cwd","logger","runtimeDir","plugins","deps","config","get","debug","os","EOL","dep","Object","keys","getModule","name","Error","importName","camelCase","type","modulePath","userPluginsFile","loadUserPluginsFile","dirs","app","userPluginName","userPluginConfig","entries","enabled","resolve","sysPath","convertModulePathToSystemPath","convertSystemPathToModulePath","path","relative","PLUGIN_CONFIGS","root","file","filePath","join","configFile","loadFile","env","getMapOfPluginsWithAdmin","pluginImportPaths","values","filter","plugin","localPluginPath","packageJsonPath","fs","existsSync","packageJson","JSON","parse","readFileSync","localAdminPath","exports","import","require","err","isError","code","map"],"mappings":";;;;;;;;;;;AA6DA,MAAMA,2BAA2B,CAC/BC,GAAAA,GAEA,YAAYA,GAAAA,IACZ,OAAOA,IAAIC,MAAM,KAAK,YACtB,CAACC,KAAAA,CAAMC,OAAO,CAACH,GAAAA,CAAIC,MAAM,CAAA,IACzBD,GAAAA,CAAIC,MAAM,KAAK,IAAA;AAEjB,MAAMG,uBAAAA,GAA0B,CAACJ,GAAAA,GAC/BD,wBAAAA,CAAyBC,QAAQA,GAAAA,CAAIC,MAAM,CAACI,IAAI,KAAK,QAAA;AAEvD,MAAMC,iBAAAA,GAAoB,OAAO,EAC/BC,GAAG,EACHC,MAAM,EACNC,UAAU,EACVR,MAAM,EACwD,GAAA;AAG9D,IAAA,MAAMS,UAAsC,EAAC;AAE7C;;;;MAKA,MAAMC,OAAOV,MAAAA,CAAOW,MAAM,CAACC,GAAG,CAAC,qBAAqB,EAAC,CAAA;AAErDL,IAAAA,MAAAA,CAAOM,KAAK,CAAC,kCAAA,EAAoCC,EAAAA,CAAGC,GAAG,EAAEL,IAAAA,CAAAA;AAEzD,IAAA,KAAK,MAAMM,GAAAA,IAAOC,MAAAA,CAAOC,IAAI,CAACR,IAAAA,CAAAA,CAAO;QACnC,MAAMX,GAAAA,GAAM,MAAMoB,sBAAAA,CAAUH,GAAAA,EAAKV,GAAAA,CAAAA;QAEjC,IAAIP,GAAAA,IAAOI,wBAAwBJ,GAAAA,CAAAA,EAAM;AACvC,YAAA,MAAMqB,OAAOrB,GAAAA,CAAIC,MAAM,CAACoB,IAAI,IAAIrB,IAAIqB,IAAI;AAExC,YAAA,IAAI,CAACA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oBAAA;AACF,gBAAA;;AAGA,gBAAA,IAAIN,GAAGC,UAAU,CAAClB,KAAKM,IAAI,CAACS,iBAAiB,iBAAA,CAAA,CAAA,EAAqB;AAChEJ,oBAAAA,iBAAiB,CAACG,MAAAA,CAAO3B,UAAU,CAAC,GAAG,cAAA;oBACvC,OAAO,IAAA;AACT,gBAAA;AACF,YAAA;;YAGA,IAAIuC,OAAAA,CAAQ9B,OAAO,CAAC,CAAA,EAAGkB,OAAO3B,UAAU,CAAC,aAAa,CAAC,CAAA,EAAG;AACxDwB,gBAAAA,iBAAiB,CAACG,MAAAA,CAAO3B,UAAU,CAAC,GAAG,cAAA;gBACvC,OAAO,IAAA;AACT,YAAA;YAEA,OAAO,KAAA;AACT,QAAA,CAAA,CAAE,OAAOwC,GAAAA,EAAK;AACZ,YAAA,IACEC,cAAAA,CAAQD,GAAAA,CAAAA,IACR,MAAA,IAAUA,GAAAA,KACTA,GAAAA,CAAIE,IAAI,KAAK,kBAAA,IAAsBF,GAAAA,CAAIE,IAAI,KAAK,+BAA8B,CAAA,EAC/E;AACA;;;AAGC,cACD,OAAO,KAAA;AACT,YAAA;YAEA,MAAMF,GAAAA;AACR,QAAA;AACF,IAAA,CAAA,CAAA,CACCG,GAAG,CAAC,CAAChB,MAAAA,IAAY;AAChB,YAAA,GAAGA,MAAM;YACT3B,UAAAA,EAAY,CAAA,EAAG2B,MAAAA,CAAO3B,UAAU,CAAC,CAAC,EAAEwB,iBAAiB,CAACG,MAAAA,CAAO3B,UAAU,CAAC,CAAA;SAC1E,CAAA,CAAA;AACJ;;;;;"}
1
+ {"version":3,"file":"plugins.js","sources":["../../../../src/node/core/plugins.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport camelCase from 'lodash/camelCase';\nimport { env } from '@strapi/utils';\nimport { getModule, PackageJson } from './dependencies';\nimport { convertModulePathToSystemPath, convertSystemPathToModulePath, loadFile } from './files';\nimport type { BaseContext } from '../types';\nimport { isError } from './errors';\n\ninterface LocalPluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * The path to the plugin, relative to the app's root directory\n * in system format\n */\n path: string;\n /**\n * The path to the plugin, relative to the runtime directory\n * in module format (i.e. with forward slashes) because thats\n * where it should be used as an import\n */\n modulePath: string;\n type: 'local';\n}\n\ninterface ModulePluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * Modules don't have a path because we never resolve them to their node_modules\n * because we simply do not require it.\n */\n path?: never;\n /**\n * The path to the plugin, relative to the app's root directory\n * in module format (i.e. with forward slashes)\n */\n modulePath: string;\n type: 'module';\n}\n\ntype PluginMeta = LocalPluginMeta | ModulePluginMeta;\n\ninterface StrapiPlugin extends PackageJson {\n strapi: {\n description?: string;\n displayName?: string;\n kind: 'plugin';\n name?: string;\n required?: boolean;\n };\n}\n\nconst validatePackageHasStrapi = (\n pkg: PackageJson\n): pkg is PackageJson & { strapi: Record<string, unknown> } =>\n 'strapi' in pkg &&\n typeof pkg.strapi === 'object' &&\n !Array.isArray(pkg.strapi) &&\n pkg.strapi !== null;\n\nconst validatePackageIsPlugin = (pkg: PackageJson): pkg is StrapiPlugin =>\n validatePackageHasStrapi(pkg) && pkg.strapi.kind === 'plugin';\n\ntype UserPluginConfig = boolean | { enabled?: boolean; resolve?: string };\n\nconst isPluginConfigEnabled = (config: UserPluginConfig): boolean => {\n if (typeof config === 'boolean') {\n return config;\n }\n\n return config.enabled !== false;\n};\n\nconst getEnabledPlugins = async ({\n cwd,\n logger,\n runtimeDir,\n strapi,\n}: Pick<BaseContext, 'cwd' | 'logger' | 'strapi' | 'runtimeDir'>): Promise<\n Record<string, PluginMeta>\n> => {\n const plugins: Record<string, PluginMeta> = {};\n\n /**\n * This is the list of dependencies that are installed in the user's project.\n * It will include libraries like \"react\", so we need to collect the ones that\n * are plugins.\n */\n const deps = strapi.config.get('info.dependencies', {});\n\n logger.debug(\"Dependencies from user's project\", os.EOL, deps);\n\n const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);\n\n logger.debug(\"User's plugins file\", os.EOL, userPluginsFile);\n\n for (const dep of Object.keys(deps)) {\n const pkg = await getModule(dep, cwd);\n\n if (pkg && validatePackageIsPlugin(pkg)) {\n const name = pkg.strapi.name || pkg.name;\n\n if (!name) {\n /**\n * Unlikely to happen, but you never know.\n */\n throw Error(\n \"You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!\"\n );\n }\n\n const userPluginConfig = userPluginsFile[name];\n\n if (userPluginConfig !== undefined && !isPluginConfigEnabled(userPluginConfig)) {\n continue;\n }\n\n plugins[name] = {\n name,\n importName: camelCase(name),\n type: 'module',\n modulePath: dep,\n };\n }\n }\n\n for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)) {\n /**\n * Local plugins must be explicitly enabled to be registered, matching the\n * server-side loader (`@strapi/core` get-enabled-plugins), which drops a\n * `{ resolve }` declaration without a truthy `enabled`. Treating an omitted\n * `enabled` as enabled here would bundle the plugin into the admin while the\n * server leaves it unloaded.\n */\n if (\n typeof userPluginConfig === 'object' &&\n userPluginConfig.enabled &&\n userPluginConfig.resolve\n ) {\n const sysPath = convertModulePathToSystemPath(userPluginConfig.resolve);\n plugins[userPluginName] = {\n name: userPluginName,\n importName: camelCase(userPluginName),\n type: 'local',\n /**\n * User plugin paths are resolved from the entry point\n * of the app, because that's how you import them.\n */\n modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, sysPath)),\n path: sysPath,\n };\n }\n }\n\n return plugins;\n};\n\nconst PLUGIN_CONFIGS = ['plugins.js', 'plugins.mjs', 'plugins.ts'];\n\ntype UserPluginConfigFile = Record<string, UserPluginConfig>;\n\nconst loadUserPluginsFile = async (root: string): Promise<UserPluginConfigFile> => {\n for (const file of PLUGIN_CONFIGS) {\n const filePath = path.join(root, file);\n const configFile = await loadFile(filePath);\n\n if (configFile) {\n /**\n * Configs can be a function or they can be just an object!\n */\n return typeof configFile === 'function' ? configFile({ env }) : configFile;\n }\n }\n\n return {};\n};\n\nconst getMapOfPluginsWithAdmin = (plugins: Record<string, PluginMeta>) => {\n /**\n * This variable stores the import paths for plugins.\n * The keys are the module paths of the plugins, and the values are the paths\n * to the admin part of the plugins, which is either loaded from the\n * package.json exports or from the legacy strapi-admin.js file.\n */\n const pluginImportPaths: Record<string, string> = {};\n\n return Object.values(plugins)\n .filter((plugin) => {\n if (!plugin) {\n return false;\n }\n\n /**\n * There are two ways a plugin should be imported, either it's local to the strapi app,\n * or it's an actual npm module that's installed and resolved via node_modules.\n *\n * We first check if the plugin is local to the strapi app, using a regular `fs.existsSync` because\n * the pathToPlugin will be relative i.e. `/Users/my-name/strapi-app/src/plugins/my-plugin`.\n *\n * If the file doesn't exist well then it's probably a node_module, so instead we use `require.resolve`\n * which will resolve the path to the module in node_modules. If it fails with the specific code `MODULE_NOT_FOUND`\n * then it doesn't have an admin part to the package.\n */\n try {\n const localPluginPath = plugin.path;\n if (localPluginPath) {\n // Here we are loading a locally installed plugin\n const packageJsonPath = path.join(localPluginPath, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n const localAdminPath = packageJson?.exports?.['./strapi-admin']?.import;\n\n if (localAdminPath) {\n pluginImportPaths[plugin.modulePath] = localAdminPath;\n return true;\n }\n }\n\n // Check if legacy admin file exists in local plugin\n if (fs.existsSync(path.join(localPluginPath, 'strapi-admin.js'))) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n }\n\n // This plugin is a module, so we need to check if it has a strapi-admin export\n if (require.resolve(`${plugin.modulePath}/strapi-admin`)) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n\n return false;\n } catch (err) {\n if (\n isError(err) &&\n 'code' in err &&\n (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')\n ) {\n /**\n * the plugin does not contain FE code, so we\n * don't want to import it anyway\n */\n return false;\n }\n\n throw err;\n }\n })\n .map((plugin) => ({\n ...plugin,\n modulePath: `${plugin.modulePath}/${pluginImportPaths[plugin.modulePath]}`,\n }));\n};\n\nexport { getEnabledPlugins, getMapOfPluginsWithAdmin };\nexport type { PluginMeta, LocalPluginMeta, ModulePluginMeta };\n"],"names":["validatePackageHasStrapi","pkg","strapi","Array","isArray","validatePackageIsPlugin","kind","isPluginConfigEnabled","config","enabled","getEnabledPlugins","cwd","logger","runtimeDir","plugins","deps","get","debug","os","EOL","userPluginsFile","loadUserPluginsFile","dirs","app","dep","Object","keys","getModule","name","Error","userPluginConfig","undefined","importName","camelCase","type","modulePath","userPluginName","entries","resolve","sysPath","convertModulePathToSystemPath","convertSystemPathToModulePath","path","relative","PLUGIN_CONFIGS","root","file","filePath","join","configFile","loadFile","env","getMapOfPluginsWithAdmin","pluginImportPaths","values","filter","plugin","localPluginPath","packageJsonPath","fs","existsSync","packageJson","JSON","parse","readFileSync","localAdminPath","exports","import","require","err","isError","code","map"],"mappings":";;;;;;;;;;;AA6DA,MAAMA,2BAA2B,CAC/BC,GAAAA,GAEA,YAAYA,GAAAA,IACZ,OAAOA,IAAIC,MAAM,KAAK,YACtB,CAACC,KAAAA,CAAMC,OAAO,CAACH,GAAAA,CAAIC,MAAM,CAAA,IACzBD,GAAAA,CAAIC,MAAM,KAAK,IAAA;AAEjB,MAAMG,uBAAAA,GAA0B,CAACJ,GAAAA,GAC/BD,wBAAAA,CAAyBC,QAAQA,GAAAA,CAAIC,MAAM,CAACI,IAAI,KAAK,QAAA;AAIvD,MAAMC,wBAAwB,CAACC,MAAAA,GAAAA;IAC7B,IAAI,OAAOA,WAAW,SAAA,EAAW;QAC/B,OAAOA,MAAAA;AACT,IAAA;IAEA,OAAOA,MAAAA,CAAOC,OAAO,KAAK,KAAA;AAC5B,CAAA;AAEA,MAAMC,iBAAAA,GAAoB,OAAO,EAC/BC,GAAG,EACHC,MAAM,EACNC,UAAU,EACVX,MAAM,EACw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AAO,KAAA;AACT,QAAA,CAAA,CAAE,OAAOkC,GAAAA,EAAK;AACZ,YAAA,IACEC,cAAAA,CAAQD,GAAAA,CAAAA,IACR,MAAA,IAAUA,GAAAA,KACTA,GAAAA,CAAIE,IAAI,KAAK,kBAAA,IAAsBF,GAAAA,CAAIE,IAAI,KAAK,+BAA8B,CAAA,EAC/E;AACA;;;AAGC,cACD,OAAO,KAAA;AACT,YAAA;YAEA,MAAMF,GAAAA;AACR,QAAA;AACF,IAAA,CAAA,CAAA,CACCG,GAAG,CAAC,CAAChB,MAAAA,IAAY;AAChB,YAAA,GAAGA,MAAM;YACTrB,UAAAA,EAAY,CAAA,EAAGqB,MAAAA,CAAOrB,UAAU,CAAC,CAAC,EAAEkB,iBAAiB,CAACG,MAAAA,CAAOrB,UAAU,CAAC,CAAA;SAC1E,CAAA,CAAA;AACJ;;;;;"}
@@ -9,6 +9,12 @@ import { isError } from './errors.mjs';
9
9
 
10
10
  const validatePackageHasStrapi = (pkg)=>'strapi' in pkg && typeof pkg.strapi === 'object' && !Array.isArray(pkg.strapi) && pkg.strapi !== null;
11
11
  const validatePackageIsPlugin = (pkg)=>validatePackageHasStrapi(pkg) && pkg.strapi.kind === 'plugin';
12
+ const isPluginConfigEnabled = (config)=>{
13
+ if (typeof config === 'boolean') {
14
+ return config;
15
+ }
16
+ return config.enabled !== false;
17
+ };
12
18
  const getEnabledPlugins = async ({ cwd, logger, runtimeDir, strapi })=>{
13
19
  const plugins = {};
14
20
  /**
@@ -17,6 +23,8 @@ const getEnabledPlugins = async ({ cwd, logger, runtimeDir, strapi })=>{
17
23
  * are plugins.
18
24
  */ const deps = strapi.config.get('info.dependencies', {});
19
25
  logger.debug("Dependencies from user's project", os.EOL, deps);
26
+ const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);
27
+ logger.debug("User's plugins file", os.EOL, userPluginsFile);
20
28
  for (const dep of Object.keys(deps)){
21
29
  const pkg = await getModule(dep, cwd);
22
30
  if (pkg && validatePackageIsPlugin(pkg)) {
@@ -26,6 +34,10 @@ const getEnabledPlugins = async ({ cwd, logger, runtimeDir, strapi })=>{
26
34
  * Unlikely to happen, but you never know.
27
35
  */ throw Error("You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!");
28
36
  }
37
+ const userPluginConfig = userPluginsFile[name];
38
+ if (userPluginConfig !== undefined && !isPluginConfigEnabled(userPluginConfig)) {
39
+ continue;
40
+ }
29
41
  plugins[name] = {
30
42
  name,
31
43
  importName: camelCase(name),
@@ -34,10 +46,14 @@ const getEnabledPlugins = async ({ cwd, logger, runtimeDir, strapi })=>{
34
46
  };
35
47
  }
36
48
  }
37
- const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);
38
- logger.debug("User's plugins file", os.EOL, userPluginsFile);
39
49
  for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)){
40
- if (userPluginConfig.enabled && userPluginConfig.resolve) {
50
+ /**
51
+ * Local plugins must be explicitly enabled to be registered, matching the
52
+ * server-side loader (`@strapi/core` get-enabled-plugins), which drops a
53
+ * `{ resolve }` declaration without a truthy `enabled`. Treating an omitted
54
+ * `enabled` as enabled here would bundle the plugin into the admin while the
55
+ * server leaves it unloaded.
56
+ */ if (typeof userPluginConfig === 'object' && userPluginConfig.enabled && userPluginConfig.resolve) {
41
57
  const sysPath = convertModulePathToSystemPath(userPluginConfig.resolve);
42
58
  plugins[userPluginName] = {
43
59
  name: userPluginName,
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.mjs","sources":["../../../../src/node/core/plugins.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport camelCase from 'lodash/camelCase';\nimport { env } from '@strapi/utils';\nimport { getModule, PackageJson } from './dependencies';\nimport { convertModulePathToSystemPath, convertSystemPathToModulePath, loadFile } from './files';\nimport type { BaseContext } from '../types';\nimport { isError } from './errors';\n\ninterface LocalPluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * The path to the plugin, relative to the app's root directory\n * in system format\n */\n path: string;\n /**\n * The path to the plugin, relative to the runtime directory\n * in module format (i.e. with forward slashes) because thats\n * where it should be used as an import\n */\n modulePath: string;\n type: 'local';\n}\n\ninterface ModulePluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * Modules don't have a path because we never resolve them to their node_modules\n * because we simply do not require it.\n */\n path?: never;\n /**\n * The path to the plugin, relative to the app's root directory\n * in module format (i.e. with forward slashes)\n */\n modulePath: string;\n type: 'module';\n}\n\ntype PluginMeta = LocalPluginMeta | ModulePluginMeta;\n\ninterface StrapiPlugin extends PackageJson {\n strapi: {\n description?: string;\n displayName?: string;\n kind: 'plugin';\n name?: string;\n required?: boolean;\n };\n}\n\nconst validatePackageHasStrapi = (\n pkg: PackageJson\n): pkg is PackageJson & { strapi: Record<string, unknown> } =>\n 'strapi' in pkg &&\n typeof pkg.strapi === 'object' &&\n !Array.isArray(pkg.strapi) &&\n pkg.strapi !== null;\n\nconst validatePackageIsPlugin = (pkg: PackageJson): pkg is StrapiPlugin =>\n validatePackageHasStrapi(pkg) && pkg.strapi.kind === 'plugin';\n\nconst getEnabledPlugins = async ({\n cwd,\n logger,\n runtimeDir,\n strapi,\n}: Pick<BaseContext, 'cwd' | 'logger' | 'strapi' | 'runtimeDir'>): Promise<\n Record<string, PluginMeta>\n> => {\n const plugins: Record<string, PluginMeta> = {};\n\n /**\n * This is the list of dependencies that are installed in the user's project.\n * It will include libraries like \"react\", so we need to collect the ones that\n * are plugins.\n */\n const deps = strapi.config.get('info.dependencies', {});\n\n logger.debug(\"Dependencies from user's project\", os.EOL, deps);\n\n for (const dep of Object.keys(deps)) {\n const pkg = await getModule(dep, cwd);\n\n if (pkg && validatePackageIsPlugin(pkg)) {\n const name = pkg.strapi.name || pkg.name;\n\n if (!name) {\n /**\n * Unlikely to happen, but you never know.\n */\n throw Error(\n \"You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!\"\n );\n }\n\n plugins[name] = {\n name,\n importName: camelCase(name),\n type: 'module',\n modulePath: dep,\n };\n }\n }\n\n const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);\n\n logger.debug(\"User's plugins file\", os.EOL, userPluginsFile);\n\n for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)) {\n if (userPluginConfig.enabled && userPluginConfig.resolve) {\n const sysPath = convertModulePathToSystemPath(userPluginConfig.resolve);\n plugins[userPluginName] = {\n name: userPluginName,\n importName: camelCase(userPluginName),\n type: 'local',\n /**\n * User plugin paths are resolved from the entry point\n * of the app, because that's how you import them.\n */\n modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, sysPath)),\n path: sysPath,\n };\n }\n }\n\n return plugins;\n};\n\nconst PLUGIN_CONFIGS = ['plugins.js', 'plugins.mjs', 'plugins.ts'];\n\ntype UserPluginConfigFile = Record<string, { enabled: boolean; resolve: string }>;\n\nconst loadUserPluginsFile = async (root: string): Promise<UserPluginConfigFile> => {\n for (const file of PLUGIN_CONFIGS) {\n const filePath = path.join(root, file);\n const configFile = await loadFile(filePath);\n\n if (configFile) {\n /**\n * Configs can be a function or they can be just an object!\n */\n return typeof configFile === 'function' ? configFile({ env }) : configFile;\n }\n }\n\n return {};\n};\n\nconst getMapOfPluginsWithAdmin = (plugins: Record<string, PluginMeta>) => {\n /**\n * This variable stores the import paths for plugins.\n * The keys are the module paths of the plugins, and the values are the paths\n * to the admin part of the plugins, which is either loaded from the\n * package.json exports or from the legacy strapi-admin.js file.\n */\n const pluginImportPaths: Record<string, string> = {};\n\n return Object.values(plugins)\n .filter((plugin) => {\n if (!plugin) {\n return false;\n }\n\n /**\n * There are two ways a plugin should be imported, either it's local to the strapi app,\n * or it's an actual npm module that's installed and resolved via node_modules.\n *\n * We first check if the plugin is local to the strapi app, using a regular `fs.existsSync` because\n * the pathToPlugin will be relative i.e. `/Users/my-name/strapi-app/src/plugins/my-plugin`.\n *\n * If the file doesn't exist well then it's probably a node_module, so instead we use `require.resolve`\n * which will resolve the path to the module in node_modules. If it fails with the specific code `MODULE_NOT_FOUND`\n * then it doesn't have an admin part to the package.\n */\n try {\n const localPluginPath = plugin.path;\n if (localPluginPath) {\n // Here we are loading a locally installed plugin\n const packageJsonPath = path.join(localPluginPath, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n const localAdminPath = packageJson?.exports?.['./strapi-admin']?.import;\n\n if (localAdminPath) {\n pluginImportPaths[plugin.modulePath] = localAdminPath;\n return true;\n }\n }\n\n // Check if legacy admin file exists in local plugin\n if (fs.existsSync(path.join(localPluginPath, 'strapi-admin.js'))) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n }\n\n // This plugin is a module, so we need to check if it has a strapi-admin export\n if (require.resolve(`${plugin.modulePath}/strapi-admin`)) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n\n return false;\n } catch (err) {\n if (\n isError(err) &&\n 'code' in err &&\n (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')\n ) {\n /**\n * the plugin does not contain FE code, so we\n * don't want to import it anyway\n */\n return false;\n }\n\n throw err;\n }\n })\n .map((plugin) => ({\n ...plugin,\n modulePath: `${plugin.modulePath}/${pluginImportPaths[plugin.modulePath]}`,\n }));\n};\n\nexport { getEnabledPlugins, getMapOfPluginsWithAdmin };\nexport type { PluginMeta, LocalPluginMeta, ModulePluginMeta };\n"],"names":["validatePackageHasStrapi","pkg","strapi","Array","isArray","validatePackageIsPlugin","kind","getEnabledPlugins","cwd","logger","runtimeDir","plugins","deps","config","get","debug","os","EOL","dep","Object","keys","getModule","name","Error","importName","camelCase","type","modulePath","userPluginsFile","loadUserPluginsFile","dirs","app","userPluginName","userPluginConfig","entries","enabled","resolve","sysPath","convertModulePathToSystemPath","convertSystemPathToModulePath","path","relative","PLUGIN_CONFIGS","root","file","filePath","join","configFile","loadFile","env","getMapOfPluginsWithAdmin","pluginImportPaths","values","filter","plugin","localPluginPath","packageJsonPath","fs","existsSync","packageJson","JSON","parse","readFileSync","localAdminPath","exports","import","require","err","isError","code","map"],"mappings":";;;;;;;;;AA6DA,MAAMA,2BAA2B,CAC/BC,GAAAA,GAEA,YAAYA,GAAAA,IACZ,OAAOA,IAAIC,MAAM,KAAK,YACtB,CAACC,KAAAA,CAAMC,OAAO,CAACH,GAAAA,CAAIC,MAAM,CAAA,IACzBD,GAAAA,CAAIC,MAAM,KAAK,IAAA;AAEjB,MAAMG,uBAAAA,GAA0B,CAACJ,GAAAA,GAC/BD,wBAAAA,CAAyBC,QAAQA,GAAAA,CAAIC,MAAM,CAACI,IAAI,KAAK,QAAA;AAEvD,MAAMC,iBAAAA,GAAoB,OAAO,EAC/BC,GAAG,EACHC,MAAM,EACNC,UAAU,EACVR,MAAM,EACwD,GAAA;AAG9D,IAAA,MAAMS,UAAsC,EAAC;AAE7C;;;;MAKA,MAAMC,OAAOV,MAAAA,CAAOW,MAAM,CAACC,GAAG,CAAC,qBAAqB,EAAC,CAAA;AAErDL,IAAAA,MAAAA,CAAOM,KAAK,CAAC,kCAAA,EAAoCC,EAAAA,CAAGC,GAAG,EAAEL,IAAAA,CAAAA;AAEzD,IAAA,KAAK,MAAMM,GAAAA,IAAOC,MAAAA,CAAOC,IAAI,CAACR,IAAAA,CAAAA,CAAO;QACnC,MAAMX,GAAAA,GAAM,MAAMoB,SAAAA,CAAUH,GAAAA,EAAKV,GAAAA,CAAAA;QAEjC,IAAIP,GAAAA,IAAOI,wBAAwBJ,GAAAA,CAAAA,EAAM;AACvC,YAAA,MAAMqB,OAAOrB,GAAAA,CAAIC,MAAM,CAACoB,IAAI,IAAIrB,IAAIqB,IAAI;AAExC,YAAA,IAAI,CAACA,IAAAA,EAAM;AACT;;AAEC,YACD,MAAMC,KAAAA,CACJ,oGAAA,CAAA;AAEJ,YAAA;YAEAZ,OAAO,CAACW,KAAK,GAAG;AAC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B;AAChEJ,oBAAAA,iBAAiB,CAACG,MAAAA,CAAO3B,UAAU,CAAC,GAAG,cAAA;oBACvC,OAAO,IAAA;AACT,gBAAA;AACF,YAAA;;YAGA,IAAIuC,OAAAA,CAAQ9B,OAAO,CAAC,CAAA,EAAGkB,OAAO3B,UAAU,CAAC,aAAa,CAAC,CAAA,EAAG;AACxDwB,gBAAAA,iBAAiB,CAACG,MAAAA,CAAO3B,UAAU,CAAC,GAAG,cAAA;gBACvC,OAAO,IAAA;AACT,YAAA;YAEA,OAAO,KAAA;AACT,QAAA,CAAA,CAAE,OAAOwC,GAAAA,EAAK;AACZ,YAAA,IACEC,OAAAA,CAAQD,GAAAA,CAAAA,IACR,MAAA,IAAUA,GAAAA,KACTA,GAAAA,CAAIE,IAAI,KAAK,kBAAA,IAAsBF,GAAAA,CAAIE,IAAI,KAAK,+BAA8B,CAAA,EAC/E;AACA;;;AAGC,cACD,OAAO,KAAA;AACT,YAAA;YAEA,MAAMF,GAAAA;AACR,QAAA;AACF,IAAA,CAAA,CAAA,CACCG,GAAG,CAAC,CAAChB,MAAAA,IAAY;AAChB,YAAA,GAAGA,MAAM;YACT3B,UAAAA,EAAY,CAAA,EAAG2B,MAAAA,CAAO3B,UAAU,CAAC,CAAC,EAAEwB,iBAAiB,CAACG,MAAAA,CAAO3B,UAAU,CAAC,CAAA;SAC1E,CAAA,CAAA;AACJ;;;;"}
1
+ {"version":3,"file":"plugins.mjs","sources":["../../../../src/node/core/plugins.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport camelCase from 'lodash/camelCase';\nimport { env } from '@strapi/utils';\nimport { getModule, PackageJson } from './dependencies';\nimport { convertModulePathToSystemPath, convertSystemPathToModulePath, loadFile } from './files';\nimport type { BaseContext } from '../types';\nimport { isError } from './errors';\n\ninterface LocalPluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * The path to the plugin, relative to the app's root directory\n * in system format\n */\n path: string;\n /**\n * The path to the plugin, relative to the runtime directory\n * in module format (i.e. with forward slashes) because thats\n * where it should be used as an import\n */\n modulePath: string;\n type: 'local';\n}\n\ninterface ModulePluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * Modules don't have a path because we never resolve them to their node_modules\n * because we simply do not require it.\n */\n path?: never;\n /**\n * The path to the plugin, relative to the app's root directory\n * in module format (i.e. with forward slashes)\n */\n modulePath: string;\n type: 'module';\n}\n\ntype PluginMeta = LocalPluginMeta | ModulePluginMeta;\n\ninterface StrapiPlugin extends PackageJson {\n strapi: {\n description?: string;\n displayName?: string;\n kind: 'plugin';\n name?: string;\n required?: boolean;\n };\n}\n\nconst validatePackageHasStrapi = (\n pkg: PackageJson\n): pkg is PackageJson & { strapi: Record<string, unknown> } =>\n 'strapi' in pkg &&\n typeof pkg.strapi === 'object' &&\n !Array.isArray(pkg.strapi) &&\n pkg.strapi !== null;\n\nconst validatePackageIsPlugin = (pkg: PackageJson): pkg is StrapiPlugin =>\n validatePackageHasStrapi(pkg) && pkg.strapi.kind === 'plugin';\n\ntype UserPluginConfig = boolean | { enabled?: boolean; resolve?: string };\n\nconst isPluginConfigEnabled = (config: UserPluginConfig): boolean => {\n if (typeof config === 'boolean') {\n return config;\n }\n\n return config.enabled !== false;\n};\n\nconst getEnabledPlugins = async ({\n cwd,\n logger,\n runtimeDir,\n strapi,\n}: Pick<BaseContext, 'cwd' | 'logger' | 'strapi' | 'runtimeDir'>): Promise<\n Record<string, PluginMeta>\n> => {\n const plugins: Record<string, PluginMeta> = {};\n\n /**\n * This is the list of dependencies that are installed in the user's project.\n * It will include libraries like \"react\", so we need to collect the ones that\n * are plugins.\n */\n const deps = strapi.config.get('info.dependencies', {});\n\n logger.debug(\"Dependencies from user's project\", os.EOL, deps);\n\n const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);\n\n logger.debug(\"User's plugins file\", os.EOL, userPluginsFile);\n\n for (const dep of Object.keys(deps)) {\n const pkg = await getModule(dep, cwd);\n\n if (pkg && validatePackageIsPlugin(pkg)) {\n const name = pkg.strapi.name || pkg.name;\n\n if (!name) {\n /**\n * Unlikely to happen, but you never know.\n */\n throw Error(\n \"You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!\"\n );\n }\n\n const userPluginConfig = userPluginsFile[name];\n\n if (userPluginConfig !== undefined && !isPluginConfigEnabled(userPluginConfig)) {\n continue;\n }\n\n plugins[name] = {\n name,\n importName: camelCase(name),\n type: 'module',\n modulePath: dep,\n };\n }\n }\n\n for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)) {\n /**\n * Local plugins must be explicitly enabled to be registered, matching the\n * server-side loader (`@strapi/core` get-enabled-plugins), which drops a\n * `{ resolve }` declaration without a truthy `enabled`. Treating an omitted\n * `enabled` as enabled here would bundle the plugin into the admin while the\n * server leaves it unloaded.\n */\n if (\n typeof userPluginConfig === 'object' &&\n userPluginConfig.enabled &&\n userPluginConfig.resolve\n ) {\n const sysPath = convertModulePathToSystemPath(userPluginConfig.resolve);\n plugins[userPluginName] = {\n name: userPluginName,\n importName: camelCase(userPluginName),\n type: 'local',\n /**\n * User plugin paths are resolved from the entry point\n * of the app, because that's how you import them.\n */\n modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, sysPath)),\n path: sysPath,\n };\n }\n }\n\n return plugins;\n};\n\nconst PLUGIN_CONFIGS = ['plugins.js', 'plugins.mjs', 'plugins.ts'];\n\ntype UserPluginConfigFile = Record<string, UserPluginConfig>;\n\nconst loadUserPluginsFile = async (root: string): Promise<UserPluginConfigFile> => {\n for (const file of PLUGIN_CONFIGS) {\n const filePath = path.join(root, file);\n const configFile = await loadFile(filePath);\n\n if (configFile) {\n /**\n * Configs can be a function or they can be just an object!\n */\n return typeof configFile === 'function' ? configFile({ env }) : configFile;\n }\n }\n\n return {};\n};\n\nconst getMapOfPluginsWithAdmin = (plugins: Record<string, PluginMeta>) => {\n /**\n * This variable stores the import paths for plugins.\n * The keys are the module paths of the plugins, and the values are the paths\n * to the admin part of the plugins, which is either loaded from the\n * package.json exports or from the legacy strapi-admin.js file.\n */\n const pluginImportPaths: Record<string, string> = {};\n\n return Object.values(plugins)\n .filter((plugin) => {\n if (!plugin) {\n return false;\n }\n\n /**\n * There are two ways a plugin should be imported, either it's local to the strapi app,\n * or it's an actual npm module that's installed and resolved via node_modules.\n *\n * We first check if the plugin is local to the strapi app, using a regular `fs.existsSync` because\n * the pathToPlugin will be relative i.e. `/Users/my-name/strapi-app/src/plugins/my-plugin`.\n *\n * If the file doesn't exist well then it's probably a node_module, so instead we use `require.resolve`\n * which will resolve the path to the module in node_modules. If it fails with the specific code `MODULE_NOT_FOUND`\n * then it doesn't have an admin part to the package.\n */\n try {\n const localPluginPath = plugin.path;\n if (localPluginPath) {\n // Here we are loading a locally installed plugin\n const packageJsonPath = path.join(localPluginPath, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n const localAdminPath = packageJson?.exports?.['./strapi-admin']?.import;\n\n if (localAdminPath) {\n pluginImportPaths[plugin.modulePath] = localAdminPath;\n return true;\n }\n }\n\n // Check if legacy admin file exists in local plugin\n if (fs.existsSync(path.join(localPluginPath, 'strapi-admin.js'))) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n }\n\n // This plugin is a module, so we need to check if it has a strapi-admin export\n if (require.resolve(`${plugin.modulePath}/strapi-admin`)) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n\n return false;\n } catch (err) {\n if (\n isError(err) &&\n 'code' in err &&\n (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')\n ) {\n /**\n * the plugin does not contain FE code, so we\n * don't want to import it anyway\n */\n return false;\n }\n\n throw err;\n }\n })\n .map((plugin) => ({\n ...plugin,\n modulePath: `${plugin.modulePath}/${pluginImportPaths[plugin.modulePath]}`,\n }));\n};\n\nexport { getEnabledPlugins, getMapOfPluginsWithAdmin };\nexport type { PluginMeta, LocalPluginMeta, ModulePluginMeta };\n"],"names":["validatePackageHasStrapi","pkg","strapi","Array","isArray","validatePackageIsPlugin","kind","isPluginConfigEnabled","config","enabled","getEnabledPlugins","cwd","logger","runtimeDir","plugins","deps","get","debug","os","EOL","userPluginsFile","loadUserPluginsFile","dirs","app","dep","Object","keys","getModule","name","Error","userPluginConfig","undefined","importName","camelCase","type","modulePath","userPluginName","entries","resolve","sysPath","convertModulePathToSystemPath","convertSystemPathToModulePath","path","relative","PLUGIN_CONFIGS","root","file","filePath","join","configFile","loadFile","env","getMapOfPluginsWithAdmin","pluginImportPaths","values","filter","plugin","localPluginPath","packageJsonPath","fs","existsSync","packageJson","JSON","parse","readFileSync","localAdminPath","exports","import","require","err","isError","code","map"],"mappings":";;;;;;;;;AA6DA,MAAMA,2BAA2B,CAC/BC,GAAAA,GAEA,YAAYA,GAAAA,IACZ,OAAOA,IAAIC,MAAM,KAAK,YACtB,CAACC,KAAAA,CAAMC,OAAO,CAACH,GAAAA,CAAIC,MAAM,CAAA,IACzBD,GAAAA,CAAIC,MAAM,KAAK,IAAA;AAEjB,MAAMG,uBAAAA,GAA0B,CAACJ,GAAAA,GAC/BD,wBAAAA,CAAyBC,QAAQA,GAAAA,CAAIC,MAAM,CAACI,IAAI,KAAK,QAAA;AAIvD,MAAMC,wBAAwB,CAACC,MAAAA,GAAAA;IAC7B,IAAI,OAAOA,WAAW,SAAA,EAAW;QAC/B,OAAOA,MAAAA;AACT,IAAA;IAEA,OAAOA,MAAAA,CAAOC,OAAO,KAAK,KAAA;AAC5B,CAAA;AAEA,MAAMC,iBAAAA,GAAoB,OAAO,EAC/BC,GAAG,EACHC,MAAM,EACNC,UAAU,EACVX,MAAM,EACwD,GAAA;AAG9D,IAAA,MAAMY,UAAsC,EAAC;AAE7C;;;;MAKA,MAAMC,OAAOb,MAAAA,CAAOM,MAAM,CAACQ,GAAG,CAAC,q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AUA,GAAAA,KACTA,GAAAA,CAAIE,IAAI,KAAK,kBAAA,IAAsBF,GAAAA,CAAIE,IAAI,KAAK,+BAA8B,CAAA,EAC/E;AACA;;;AAGC,cACD,OAAO,KAAA;AACT,YAAA;YAEA,MAAMF,GAAAA;AACR,QAAA;AACF,IAAA,CAAA,CAAA,CACCG,GAAG,CAAC,CAAChB,MAAAA,IAAY;AAChB,YAAA,GAAGA,MAAM;YACTrB,UAAAA,EAAY,CAAA,EAAGqB,MAAAA,CAAOrB,UAAU,CAAC,CAAC,EAAEkB,iBAAiB,CAACG,MAAAA,CAAOrB,UAAU,CAAC,CAAA;SAC1E,CAAA,CAAA;AACJ;;;;"}
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var browserslistToEsbuild = require('browserslist-to-esbuild');
4
3
  var react = require('@vitejs/plugin-react-swc');
5
4
  var config = require('../core/config.js');
6
5
  var resolveModule = require('../core/resolve-module.js');
@@ -10,6 +9,7 @@ var aliases = require('../core/aliases.js');
10
9
  var plugins = require('./plugins.js');
11
10
 
12
11
  const resolveBaseConfig = async (ctx)=>{
12
+ const { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');
13
13
  const target = browserslistToEsbuild(ctx.target);
14
14
  const isMonorepoExampleApp = ctx.strapi.internal_config?.uuid === 'getstarted';
15
15
  const designSystemLinked = linkedPackages.isDesignSystemLinked();
@@ -45,6 +45,10 @@ const resolveBaseConfig = async (ctx)=>{
45
45
  'react-dom/client',
46
46
  'styled-components',
47
47
  'react-router-dom',
48
+ // Admin + RTK Query share react-redux context; pre-bundle so dev chunks cannot load a
49
+ // second copy (avoids "could not find react-redux context value" after upgrades / hoisting).
50
+ 'react-redux',
51
+ '@reduxjs/toolkit',
48
52
  // Pre-bundle design-system so plugin custom field chunks (dynamic imports) resolve
49
53
  // to the same instance as the main app. Otherwise TooltipProvider/DesignSystemProvider
50
54
  // context from the root is not seen by components in plugin chunks.
@@ -108,7 +112,6 @@ const resolveBaseConfig = async (ctx)=>{
108
112
  'react-colorful',
109
113
  'react-dnd-html5-backend',
110
114
  'react-window',
111
- 'sanitize-html',
112
115
  'semver',
113
116
  'semver/functions/lt',
114
117
  'semver/functions/valid',
@@ -127,6 +130,8 @@ const resolveBaseConfig = async (ctx)=>{
127
130
  'react-dom',
128
131
  'react-router-dom',
129
132
  'styled-components',
133
+ 'react-redux',
134
+ '@reduxjs/toolkit',
130
135
  '@strapi/design-system',
131
136
  '@radix-ui/react-tooltip',
132
137
  'lodash'
@@ -138,6 +143,8 @@ const resolveBaseConfig = async (ctx)=>{
138
143
  'react-dom': resolveModule.getModulePath('react-dom'),
139
144
  'react-router-dom': resolveModule.getModulePath('react-router-dom'),
140
145
  'styled-components': resolveModule.getModulePath('styled-components'),
146
+ 'react-redux': resolveModule.getModulePath('react-redux'),
147
+ '@reduxjs/toolkit': resolveModule.getModulePath('@reduxjs/toolkit'),
141
148
  '@strapi/design-system': resolveModule.getModulePath('@strapi/design-system'),
142
149
  '@radix-ui/react-tooltip': resolveModule.getModulePath('@radix-ui/react-tooltip'),
143
150
  lodash: resolveModule.getModulePath('lodash')
@@ -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 { getModulePath } from '../core/resolve-module';\nimport { isDesignSystemLinked } from '../core/linked-packages';\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 const isMonorepoExampleApp = (ctx.strapi as any).internal_config?.uuid === 'getstarted';\n const designSystemLinked = isDesignSystemLinked();\n\n return {\n root: ctx.cwd,\n base: ctx.basePath,\n build: {\n emptyOutDir: false, // Rely on CLI to do this\n outDir: ctx.distDir,\n target,\n },\n cacheDir: 'node_modules/.strapi/vite',\n configFile: false,\n define: {\n process: {},\n 'process.env': JSON.stringify(ctx.env),\n },\n envPrefix: 'STRAPI_ADMIN_',\n optimizeDeps: {\n // When design-system is linked (portal:, file:, yarn link), exclude from pre-bundling\n // so changes are reflected without clearing node_modules/.strapi/vite cache\n ...(designSystemLinked && { exclude: ['@strapi/design-system'] }),\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 // Pre-bundle design-system so plugin custom field chunks (dynamic imports) resolve\n // to the same instance as the main app. Otherwise TooltipProvider/DesignSystemProvider\n // context from the root is not seen by components in plugin chunks.\n // Omit when linked so local changes are picked up (see exclude above)\n ...(!designSystemLinked ? ['@strapi/design-system'] : []),\n '@radix-ui/react-tooltip',\n // Pre-bundle lodash: design-system uses named imports (e.g. assignWith) but lodash\n // is CommonJS-only; pre-bundling converts it to ESM for the browser\n 'lodash',\n // Pre-bundle prismjs so plugin chunks get a valid ESM namespace (prismjs is UMD and can\n // otherwise expose an empty object when bundled, causing \"Prism is not defined\" in admin).\n 'prismjs',\n /**\n * Pre-bundle other dependencies that would otherwise cause a page reload when imported.\n * See \"performance\" section: https://vite.dev/guide/dep-pre-bundling.html#the-why\n * Only include dependencies for our internal example apps, otherwise it will break\n * real user apps that may not have those dependencies.\n */\n ...(isMonorepoExampleApp\n ? [\n '@dnd-kit/core',\n '@dnd-kit/sortable',\n '@dnd-kit/utilities',\n '@dnd-kit/modifiers',\n '@radix-ui/react-toolbar',\n 'codemirror5',\n 'codemirror5/addon/display/placeholder',\n 'date-fns-tz',\n 'date-fns/format',\n 'date-fns/formatISO',\n 'highlight.js',\n 'lodash/capitalize',\n 'lodash/fp',\n 'lodash/groupBy',\n 'lodash/has',\n 'lodash/isNil',\n 'lodash/locale',\n 'lodash/map',\n 'lodash/mapValues',\n 'lodash/pull',\n 'lodash/size',\n 'lodash/sortBy',\n 'lodash/tail',\n 'lodash/toLower',\n 'lodash/toNumber',\n 'lodash/toString',\n 'lodash/truncate',\n 'lodash/uniq',\n 'lodash/upperFirst',\n 'markdown-it',\n 'markdown-it-abbr',\n 'markdown-it-container',\n 'markdown-it-deflist',\n 'markdown-it-emoji',\n 'markdown-it-footnote',\n 'markdown-it-ins',\n 'markdown-it-mark',\n 'markdown-it-sub',\n 'markdown-it-sup',\n 'prismjs/components/*.js',\n 'react-colorful',\n 'react-dnd-html5-backend',\n 'react-window',\n 'sanitize-html',\n 'semver',\n 'semver/functions/lt',\n 'semver/functions/valid',\n 'slate',\n 'slate-history',\n 'slate-react',\n 'motion',\n ]\n : []),\n ],\n },\n resolve: {\n // https://react.dev/warnings/invalid-hook-call-warning#duplicate-react\n // Include design-system so plugin chunks use the same instance and inherit root context\n dedupe: [\n 'react',\n 'react-dom',\n 'react-router-dom',\n 'styled-components',\n '@strapi/design-system',\n '@radix-ui/react-tooltip',\n 'lodash',\n ],\n // Explicit aliases ensure resolution under pnpm's strict dependency isolation,\n // where packages imported by plugins may not be resolvable from plugin chunks\n alias: {\n react: getModulePath('react'),\n 'react-dom': getModulePath('react-dom'),\n 'react-router-dom': getModulePath('react-router-dom'),\n 'styled-components': getModulePath('styled-components'),\n '@strapi/design-system': getModulePath('@strapi/design-system'),\n '@radix-ui/react-tooltip': getModulePath('@radix-ui/react-tooltip'),\n lodash: getModulePath('lodash'),\n },\n },\n plugins: [react(), buildFilesPlugin(ctx)],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const {\n options: { minify, sourcemaps },\n } = ctx;\n\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n logLevel: 'silent',\n mode: 'production',\n build: {\n ...baseConfig.build,\n assetsDir: '',\n minify,\n sourcemap: sourcemaps,\n rollupOptions: {\n input: {\n strapi: ctx.entry,\n },\n },\n },\n };\n};\n\nconst resolveDevelopmentConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const monorepo = await loadStrapiMonorepo(ctx.cwd);\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n mode: 'development',\n resolve: {\n ...baseConfig.resolve,\n alias: {\n ...baseConfig.resolve?.alias,\n ...getMonorepoAliases({ monorepo }),\n },\n },\n server: {\n cors: false,\n middlewareMode: true,\n open: ctx.options.open,\n hmr: {\n overlay: false,\n server: ctx.options.hmrServer,\n clientPort: ctx.options.hmrClientPort,\n },\n },\n appType: 'custom',\n };\n};\n\nconst USER_CONFIGS = ['vite.config.js', 'vite.config.mjs', 'vite.config.ts', 'vite.config.mts'];\n\ntype UserViteConfig = (config: UserConfig) => UserConfig;\n\nconst mergeConfigWithUserConfig = async (config: InlineConfig, ctx: BuildContext) => {\n const userConfig = await getUserConfig<UserViteConfig>(USER_CONFIGS, ctx);\n\n if (userConfig) {\n return userConfig(config);\n }\n\n return config;\n};\n\nexport { mergeConfigWithUserConfig, resolveProductionConfig, resolveDevelopmentConfig };\n"],"names":["resolveBaseConfig","ctx","target","browserslistToEsbuild","isMonorepoExampleApp","strapi","internal_config","uuid","designSystemLinked","isDesignSystemLinked","root","cwd","base","basePath","build","emptyOutDir","outDir","distDir","cacheDir","configFile","define","process","JSON","stringify","env","envPrefix","optimizeDeps","exclude","include","resolve","dedupe","alias","react","getModulePath","lodash","plugins","buildFilesPlugin","resolveProductionConfig","options","minify","sourcemaps","baseConfig","logLevel","mode","assetsDir","sourcemap","rollupOptions","input","entry","resolveDevelopmentConfig","monorepo","loadStrapiMonorepo","getMonorepoAliases","server","cors","middlewareMode","open","hmr","overlay","hmrServer","clientPort","hmrClientPort","appType","USER_CONFIGS","mergeConfigWithUserConfig","config","userConfig","getUserConfig"],"mappings":";;;;;;;;;;;AAYA,MAAMA,oBAAoB,OAAOC,GAAA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AGqB,0BAAAA,CAAmB;AAAEF,8BAAAA;iBAAS;AACnC;AACF,SAAA;QACAG,MAAAA,EAAQ;YACNC,IAAAA,EAAM,KAAA;YACNC,cAAAA,EAAgB,IAAA;YAChBC,IAAAA,EAAMvD,GAAAA,CAAIqC,OAAO,CAACkB,IAAI;YACtBC,GAAAA,EAAK;gBACHC,OAAAA,EAAS,KAAA;gBACTL,MAAAA,EAAQpD,GAAAA,CAAIqC,OAAO,CAACqB,SAAS;gBAC7BC,UAAAA,EAAY3D,GAAAA,CAAIqC,OAAO,CAACuB;AAC1B;AACF,SAAA;QACAC,OAAAA,EAAS;AACX,KAAA;AACF;AAEA,MAAMC,YAAAA,GAAe;AAAC,IAAA,gBAAA;AAAkB,IAAA,iBAAA;AAAmB,IAAA,gBAAA;AAAkB,IAAA;AAAkB,CAAA;AAI/F,MAAMC,yBAAAA,GAA4B,OAAOC,QAAAA,EAAsBhE,GAAAA,GAAAA;IAC7D,MAAMiE,UAAAA,GAAa,MAAMC,oBAAAA,CAA8BJ,YAAAA,EAAc9D,GAAAA,CAAAA;AAErE,IAAA,IAAIiE,UAAAA,EAAY;AACd,QAAA,OAAOA,UAAAA,CAAWD,QAAAA,CAAAA;AACpB,IAAA;IAEA,OAAOA,QAAAA;AACT;;;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../../../src/node/vite/config.ts"],"sourcesContent":["import type { InlineConfig, UserConfig } from 'vite';\nimport react from '@vitejs/plugin-react-swc';\n\nimport { getUserConfig } from '../core/config';\nimport { getModulePath } from '../core/resolve-module';\nimport { isDesignSystemLinked } from '../core/linked-packages';\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 { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');\n const target = browserslistToEsbuild(ctx.target);\n const isMonorepoExampleApp = (ctx.strapi as any).internal_config?.uuid === 'getstarted';\n const designSystemLinked = isDesignSystemLinked();\n\n return {\n root: ctx.cwd,\n base: ctx.basePath,\n build: {\n emptyOutDir: false, // Rely on CLI to do this\n outDir: ctx.distDir,\n target,\n },\n cacheDir: 'node_modules/.strapi/vite',\n configFile: false,\n define: {\n process: {},\n 'process.env': JSON.stringify(ctx.env),\n },\n envPrefix: 'STRAPI_ADMIN_',\n optimizeDeps: {\n // When design-system is linked (portal:, file:, yarn link), exclude from pre-bundling\n // so changes are reflected without clearing node_modules/.strapi/vite cache\n ...(designSystemLinked && { exclude: ['@strapi/design-system'] }),\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 // Admin + RTK Query share react-redux context; pre-bundle so dev chunks cannot load a\n // second copy (avoids \"could not find react-redux context value\" after upgrades / hoisting).\n 'react-redux',\n '@reduxjs/toolkit',\n // Pre-bundle design-system so plugin custom field chunks (dynamic imports) resolve\n // to the same instance as the main app. Otherwise TooltipProvider/DesignSystemProvider\n // context from the root is not seen by components in plugin chunks.\n // Omit when linked so local changes are picked up (see exclude above)\n ...(!designSystemLinked ? ['@strapi/design-system'] : []),\n '@radix-ui/react-tooltip',\n // Pre-bundle lodash: design-system uses named imports (e.g. assignWith) but lodash\n // is CommonJS-only; pre-bundling converts it to ESM for the browser\n 'lodash',\n // Pre-bundle prismjs so plugin chunks get a valid ESM namespace (prismjs is UMD and can\n // otherwise expose an empty object when bundled, causing \"Prism is not defined\" in admin).\n 'prismjs',\n /**\n * Pre-bundle other dependencies that would otherwise cause a page reload when imported.\n * See \"performance\" section: https://vite.dev/guide/dep-pre-bundling.html#the-why\n * Only include dependencies for our internal example apps, otherwise it will break\n * real user apps that may not have those dependencies.\n */\n ...(isMonorepoExampleApp\n ? [\n '@dnd-kit/core',\n '@dnd-kit/sortable',\n '@dnd-kit/utilities',\n '@dnd-kit/modifiers',\n '@radix-ui/react-toolbar',\n 'codemirror5',\n 'codemirror5/addon/display/placeholder',\n 'date-fns-tz',\n 'date-fns/format',\n 'date-fns/formatISO',\n 'highlight.js',\n 'lodash/capitalize',\n 'lodash/fp',\n 'lodash/groupBy',\n 'lodash/has',\n 'lodash/isNil',\n 'lodash/locale',\n 'lodash/map',\n 'lodash/mapValues',\n 'lodash/pull',\n 'lodash/size',\n 'lodash/sortBy',\n 'lodash/tail',\n 'lodash/toLower',\n 'lodash/toNumber',\n 'lodash/toString',\n 'lodash/truncate',\n 'lodash/uniq',\n 'lodash/upperFirst',\n 'markdown-it',\n 'markdown-it-abbr',\n 'markdown-it-container',\n 'markdown-it-deflist',\n 'markdown-it-emoji',\n 'markdown-it-footnote',\n 'markdown-it-ins',\n 'markdown-it-mark',\n 'markdown-it-sub',\n 'markdown-it-sup',\n 'prismjs/components/*.js',\n 'react-colorful',\n 'react-dnd-html5-backend',\n 'react-window',\n 'semver',\n 'semver/functions/lt',\n 'semver/functions/valid',\n 'slate',\n 'slate-history',\n 'slate-react',\n 'motion',\n ]\n : []),\n ],\n },\n resolve: {\n // https://react.dev/warnings/invalid-hook-call-warning#duplicate-react\n // Include design-system so plugin chunks use the same instance and inherit root context\n dedupe: [\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 ],\n // Explicit aliases ensure resolution under pnpm's strict dependency isolation,\n // where packages imported by plugins may not be resolvable from plugin chunks\n alias: {\n react: getModulePath('react'),\n 'react-dom': getModulePath('react-dom'),\n 'react-router-dom': getModulePath('react-router-dom'),\n 'styled-components': getModulePath('styled-components'),\n 'react-redux': getModulePath('react-redux'),\n '@reduxjs/toolkit': getModulePath('@reduxjs/toolkit'),\n '@strapi/design-system': getModulePath('@strapi/design-system'),\n '@radix-ui/react-tooltip': getModulePath('@radix-ui/react-tooltip'),\n lodash: getModulePath('lodash'),\n },\n },\n plugins: [react(), buildFilesPlugin(ctx)],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const {\n options: { minify, sourcemaps },\n } = ctx;\n\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n logLevel: 'silent',\n mode: 'production',\n build: {\n ...baseConfig.build,\n assetsDir: '',\n minify,\n sourcemap: sourcemaps,\n rollupOptions: {\n input: {\n strapi: ctx.entry,\n },\n },\n },\n };\n};\n\nconst resolveDevelopmentConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const monorepo = await loadStrapiMonorepo(ctx.cwd);\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n mode: 'development',\n resolve: {\n ...baseConfig.resolve,\n alias: {\n ...baseConfig.resolve?.alias,\n ...getMonorepoAliases({ monorepo }),\n },\n },\n server: {\n cors: false,\n middlewareMode: true,\n open: ctx.options.open,\n hmr: {\n overlay: false,\n server: ctx.options.hmrServer,\n clientPort: ctx.options.hmrClientPort,\n },\n },\n appType: 'custom',\n };\n};\n\nconst USER_CONFIGS = ['vite.config.js', 'vite.config.mjs', 'vite.config.ts', 'vite.config.mts'];\n\ntype UserViteConfig = (config: UserConfig) => UserConfig;\n\nconst mergeConfigWithUserConfig = async (config: InlineConfig, ctx: BuildContext) => {\n const userConfig = await getUserConfig<UserViteConfig>(USER_CONFIGS, ctx);\n\n if (userConfig) {\n return userConfig(config);\n }\n\n return config;\n};\n\nexport { mergeConfigWithUserConfig, resolveProductionConfig, resolveDevelopmentConfig };\n"],"names":["resolveBaseConfig","ctx","default","browserslistToEsbuild","target","isMonorepoExampleApp","strapi","internal_config","uuid","designSystemLinked","isDesignSystemLinked","root","cwd","base","basePath","build","emptyOutDir","outDir","distDir","cacheDir","configFile","define","process","JSON","stringify","env","envPrefix","optimizeDeps","exclude","include","resolve","dedupe","alias","react","getModulePath","lodash","plugins","buildFilesPlugin","resolveProductionConfig","options","minify","sourcemaps","baseConfig","logLevel","mode","assetsDir","sourcemap","rollupOptions","input","entry","resolveDevelopmentConfig","monorepo","loadStrapiMonorepo","getMonorepoAliases","server","cors","middlewareMode","open","hmr","overlay","hmrServer","clientPort","hmrClientPort","appType","USER_CONFIGS","mergeConfigWithUserConfig","config","userConfig","getUserConfig"],"mappings":";;;;;;;;;;AAWA,MAAMA,oBAAoB,OAAOC,GAAAA,GAAAA;AAC/B,IAAA,MAAM,EAAEC,OAAAA,EAASC,qBAAqB,EAAE,GAAG,MAAM,OAAO,yBAAA,CAAA;IACxD,MAAMC,MAAAA,GAASD,qBAAAA,CAAsBF,GAAAA,CAAIG,MAAM,CAAA;AAC/C,IAAA,MAAMC,uBAAuB,GAACJ,CAAIK,MAAM,CAASC,eAAe,EAAEC,IAAAA,KAAS,YAAA;AAC3E,IAAA,MAAMC,kBAAAA,GAAqBC,mCAAAA,EAAAA;IAE3B,OAAO;AACLC,QAAAA,IAAAA,EAAMV,IAAIW,GAAG;AACbC,QAAAA,IAAAA,EAAMZ,IAAIa,QAAQ;QAClBC,KAAAA,EAAO;YACLC,WAAAA,EAAa,KAAA;AACbC,YAAAA,MAAAA,EAAQhB,IAAIiB,OAAO;AACnBd,YAAAA;AACF,SAAA;QACAe,QAAAA,EAAU,2BAAA;QACVC,UAAAA,EAAY,KAAA;QACZC,MAAAA,EAAQ;AACNC,YAAAA,OAAAA,EAAS,EAAC;AACV,YAAA,aAAA,EAAeC,IAAAA,CAAKC,SAAS,CAACvB,GAAAA,CAAIwB,GAAG;AACvC,SAAA;QACAC,SAAAA,EAAW,eAAA;QACXC,YAAAA,EAAc;;;AAGZ,YAAA,GAAIlB,kBAAAA,IAAsB;gBAAEmB,OAAAA,EAAS;AAAC,oBAAA;AAAwB;aAAE;YAChEC,OAAAA,EAAS;;;;AAIP,gBAAA,OAAA;AACA,gBAAA,CAAC,iBAAiB,CAAC;AACnB,gBAAA,kBAAA;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A,IAAIkE,UAAAA,EAAY;AACd,QAAA,OAAOA,UAAAA,CAAWD,QAAAA,CAAAA;AACpB,IAAA;IAEA,OAAOA,QAAAA;AACT;;;;;;"}
@@ -1,4 +1,3 @@
1
- import browserslistToEsbuild from 'browserslist-to-esbuild';
2
1
  import react from '@vitejs/plugin-react-swc';
3
2
  import { getUserConfig } from '../core/config.mjs';
4
3
  import { getModulePath } from '../core/resolve-module.mjs';
@@ -8,6 +7,7 @@ import { getMonorepoAliases } from '../core/aliases.mjs';
8
7
  import { buildFilesPlugin } from './plugins.mjs';
9
8
 
10
9
  const resolveBaseConfig = async (ctx)=>{
10
+ const { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');
11
11
  const target = browserslistToEsbuild(ctx.target);
12
12
  const isMonorepoExampleApp = ctx.strapi.internal_config?.uuid === 'getstarted';
13
13
  const designSystemLinked = isDesignSystemLinked();
@@ -43,6 +43,10 @@ const resolveBaseConfig = async (ctx)=>{
43
43
  'react-dom/client',
44
44
  'styled-components',
45
45
  'react-router-dom',
46
+ // Admin + RTK Query share react-redux context; pre-bundle so dev chunks cannot load a
47
+ // second copy (avoids "could not find react-redux context value" after upgrades / hoisting).
48
+ 'react-redux',
49
+ '@reduxjs/toolkit',
46
50
  // Pre-bundle design-system so plugin custom field chunks (dynamic imports) resolve
47
51
  // to the same instance as the main app. Otherwise TooltipProvider/DesignSystemProvider
48
52
  // context from the root is not seen by components in plugin chunks.
@@ -106,7 +110,6 @@ const resolveBaseConfig = async (ctx)=>{
106
110
  'react-colorful',
107
111
  'react-dnd-html5-backend',
108
112
  'react-window',
109
- 'sanitize-html',
110
113
  'semver',
111
114
  'semver/functions/lt',
112
115
  'semver/functions/valid',
@@ -125,6 +128,8 @@ const resolveBaseConfig = async (ctx)=>{
125
128
  'react-dom',
126
129
  'react-router-dom',
127
130
  'styled-components',
131
+ 'react-redux',
132
+ '@reduxjs/toolkit',
128
133
  '@strapi/design-system',
129
134
  '@radix-ui/react-tooltip',
130
135
  'lodash'
@@ -136,6 +141,8 @@ const resolveBaseConfig = async (ctx)=>{
136
141
  'react-dom': getModulePath('react-dom'),
137
142
  'react-router-dom': getModulePath('react-router-dom'),
138
143
  'styled-components': getModulePath('styled-components'),
144
+ 'react-redux': getModulePath('react-redux'),
145
+ '@reduxjs/toolkit': getModulePath('@reduxjs/toolkit'),
139
146
  '@strapi/design-system': getModulePath('@strapi/design-system'),
140
147
  '@radix-ui/react-tooltip': getModulePath('@radix-ui/react-tooltip'),
141
148
  lodash: getModulePath('lodash')
@@ -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 { getModulePath } from '../core/resolve-module';\nimport { isDesignSystemLinked } from '../core/linked-packages';\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 const isMonorepoExampleApp = (ctx.strapi as any).internal_config?.uuid === 'getstarted';\n const designSystemLinked = isDesignSystemLinked();\n\n return {\n root: ctx.cwd,\n base: ctx.basePath,\n build: {\n emptyOutDir: false, // Rely on CLI to do this\n outDir: ctx.distDir,\n target,\n },\n cacheDir: 'node_modules/.strapi/vite',\n configFile: false,\n define: {\n process: {},\n 'process.env': JSON.stringify(ctx.env),\n },\n envPrefix: 'STRAPI_ADMIN_',\n optimizeDeps: {\n // When design-system is linked (portal:, file:, yarn link), exclude from pre-bundling\n // so changes are reflected without clearing node_modules/.strapi/vite cache\n ...(designSystemLinked && { exclude: ['@strapi/design-system'] }),\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 // Pre-bundle design-system so plugin custom field chunks (dynamic imports) resolve\n // to the same instance as the main app. Otherwise TooltipProvider/DesignSystemProvider\n // context from the root is not seen by components in plugin chunks.\n // Omit when linked so local changes are picked up (see exclude above)\n ...(!designSystemLinked ? ['@strapi/design-system'] : []),\n '@radix-ui/react-tooltip',\n // Pre-bundle lodash: design-system uses named imports (e.g. assignWith) but lodash\n // is CommonJS-only; pre-bundling converts it to ESM for the browser\n 'lodash',\n // Pre-bundle prismjs so plugin chunks get a valid ESM namespace (prismjs is UMD and can\n // otherwise expose an empty object when bundled, causing \"Prism is not defined\" in admin).\n 'prismjs',\n /**\n * Pre-bundle other dependencies that would otherwise cause a page reload when imported.\n * See \"performance\" section: https://vite.dev/guide/dep-pre-bundling.html#the-why\n * Only include dependencies for our internal example apps, otherwise it will break\n * real user apps that may not have those dependencies.\n */\n ...(isMonorepoExampleApp\n ? [\n '@dnd-kit/core',\n '@dnd-kit/sortable',\n '@dnd-kit/utilities',\n '@dnd-kit/modifiers',\n '@radix-ui/react-toolbar',\n 'codemirror5',\n 'codemirror5/addon/display/placeholder',\n 'date-fns-tz',\n 'date-fns/format',\n 'date-fns/formatISO',\n 'highlight.js',\n 'lodash/capitalize',\n 'lodash/fp',\n 'lodash/groupBy',\n 'lodash/has',\n 'lodash/isNil',\n 'lodash/locale',\n 'lodash/map',\n 'lodash/mapValues',\n 'lodash/pull',\n 'lodash/size',\n 'lodash/sortBy',\n 'lodash/tail',\n 'lodash/toLower',\n 'lodash/toNumber',\n 'lodash/toString',\n 'lodash/truncate',\n 'lodash/uniq',\n 'lodash/upperFirst',\n 'markdown-it',\n 'markdown-it-abbr',\n 'markdown-it-container',\n 'markdown-it-deflist',\n 'markdown-it-emoji',\n 'markdown-it-footnote',\n 'markdown-it-ins',\n 'markdown-it-mark',\n 'markdown-it-sub',\n 'markdown-it-sup',\n 'prismjs/components/*.js',\n 'react-colorful',\n 'react-dnd-html5-backend',\n 'react-window',\n 'sanitize-html',\n 'semver',\n 'semver/functions/lt',\n 'semver/functions/valid',\n 'slate',\n 'slate-history',\n 'slate-react',\n 'motion',\n ]\n : []),\n ],\n },\n resolve: {\n // https://react.dev/warnings/invalid-hook-call-warning#duplicate-react\n // Include design-system so plugin chunks use the same instance and inherit root context\n dedupe: [\n 'react',\n 'react-dom',\n 'react-router-dom',\n 'styled-components',\n '@strapi/design-system',\n '@radix-ui/react-tooltip',\n 'lodash',\n ],\n // Explicit aliases ensure resolution under pnpm's strict dependency isolation,\n // where packages imported by plugins may not be resolvable from plugin chunks\n alias: {\n react: getModulePath('react'),\n 'react-dom': getModulePath('react-dom'),\n 'react-router-dom': getModulePath('react-router-dom'),\n 'styled-components': getModulePath('styled-components'),\n '@strapi/design-system': getModulePath('@strapi/design-system'),\n '@radix-ui/react-tooltip': getModulePath('@radix-ui/react-tooltip'),\n lodash: getModulePath('lodash'),\n },\n },\n plugins: [react(), buildFilesPlugin(ctx)],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const {\n options: { minify, sourcemaps },\n } = ctx;\n\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n logLevel: 'silent',\n mode: 'production',\n build: {\n ...baseConfig.build,\n assetsDir: '',\n minify,\n sourcemap: sourcemaps,\n rollupOptions: {\n input: {\n strapi: ctx.entry,\n },\n },\n },\n };\n};\n\nconst resolveDevelopmentConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const monorepo = await loadStrapiMonorepo(ctx.cwd);\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n mode: 'development',\n resolve: {\n ...baseConfig.resolve,\n alias: {\n ...baseConfig.resolve?.alias,\n ...getMonorepoAliases({ monorepo }),\n },\n },\n server: {\n cors: false,\n middlewareMode: true,\n open: ctx.options.open,\n hmr: {\n overlay: false,\n server: ctx.options.hmrServer,\n clientPort: ctx.options.hmrClientPort,\n },\n },\n appType: 'custom',\n };\n};\n\nconst USER_CONFIGS = ['vite.config.js', 'vite.config.mjs', 'vite.config.ts', 'vite.config.mts'];\n\ntype UserViteConfig = (config: UserConfig) => UserConfig;\n\nconst mergeConfigWithUserConfig = async (config: InlineConfig, ctx: BuildContext) => {\n const userConfig = await getUserConfig<UserViteConfig>(USER_CONFIGS, ctx);\n\n if (userConfig) {\n return userConfig(config);\n }\n\n return config;\n};\n\nexport { mergeConfigWithUserConfig, resolveProductionConfig, resolveDevelopmentConfig };\n"],"names":["resolveBaseConfig","ctx","target","browserslistToEsbuild","isMonorepoExampleApp","strapi","internal_config","uuid","designSystemLinked","isDesignSystemLinked","root","cwd","base","basePath","build","emptyOutDir","outDir","distDir","cacheDir","configFile","define","process","JSON","stringify","env","envPrefix","optimizeDeps","exclude","include","resolve","dedupe","alias","react","getModulePath","lodash","plugins","buildFilesPlugin","resolveProductionConfig","options","minify","sourcemaps","baseConfig","logLevel","mode","assetsDir","sourcemap","rollupOptions","input","entry","resolveDevelopmentConfig","monorepo","loadStrapiMonorepo","getMonorepoAliases","server","cors","middlewareMode","open","hmr","overlay","hmrServer","clientPort","hmrClientPort","appType","USER_CONFIGS","mergeConfigWithUserConfig","config","userConfig","getUserConfig"],"mappings":";;;;;;;;;AAYA,MAAMA,oBAAoB,OAAOC,GAAAA,GAAAA;IAC/B,MAAMC,MAAAA,GAASC,qBAAAA,CAAsBF,GAAAA,CAAIC,MAAM,CAAA;AAC/C,IAAA,MAAME,uBAAuB,GAACH,CAAII,MAAM,CAASC,eAAe,EAAEC,IAAAA,KAAS,YAAA;AAC3E,IAAA,MAAMC,kBAAAA,GAAqBC,oBAAAA,EAAAA;IAE3B,OAAO;AACLC,QAAAA,IAAAA,EAAMT,IAAIU,GAAG;AACbC,QAAAA,IAAAA,EAAMX,IAAIY,QAAQ;QAClBC,KAAAA,EAAO;YACLC,WAAAA,EAAa,KAAA;A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ACAC,OAAAA,EAAS;AACX,KAAA;AACF;AAEA,MAAMC,YAAAA,GAAe;AAAC,IAAA,gBAAA;AAAkB,IAAA,iBAAA;AAAmB,IAAA,gBAAA;AAAkB,IAAA;AAAkB,CAAA;AAI/F,MAAMC,yBAAAA,GAA4B,OAAOC,MAAAA,EAAsBhE,GAAAA,GAAAA;IAC7D,MAAMiE,UAAAA,GAAa,MAAMC,aAAAA,CAA8BJ,YAAAA,EAAc9D,GAAAA,CAAAA;AAErE,IAAA,IAAIiE,UAAAA,EAAY;AACd,QAAA,OAAOA,UAAAA,CAAWD,MAAAA,CAAAA;AACpB,IAAA;IAEA,OAAOA,MAAAA;AACT;;;;"}
1
+ {"version":3,"file":"config.mjs","sources":["../../../../src/node/vite/config.ts"],"sourcesContent":["import type { InlineConfig, UserConfig } from 'vite';\nimport react from '@vitejs/plugin-react-swc';\n\nimport { getUserConfig } from '../core/config';\nimport { getModulePath } from '../core/resolve-module';\nimport { isDesignSystemLinked } from '../core/linked-packages';\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 { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');\n const target = browserslistToEsbuild(ctx.target);\n const isMonorepoExampleApp = (ctx.strapi as any).internal_config?.uuid === 'getstarted';\n const designSystemLinked = isDesignSystemLinked();\n\n return {\n root: ctx.cwd,\n base: ctx.basePath,\n build: {\n emptyOutDir: false, // Rely on CLI to do this\n outDir: ctx.distDir,\n target,\n },\n cacheDir: 'node_modules/.strapi/vite',\n configFile: false,\n define: {\n process: {},\n 'process.env': JSON.stringify(ctx.env),\n },\n envPrefix: 'STRAPI_ADMIN_',\n optimizeDeps: {\n // When design-system is linked (portal:, file:, yarn link), exclude from pre-bundling\n // so changes are reflected without clearing node_modules/.strapi/vite cache\n ...(designSystemLinked && { exclude: ['@strapi/design-system'] }),\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 // Admin + RTK Query share react-redux context; pre-bundle so dev chunks cannot load a\n // second copy (avoids \"could not find react-redux context value\" after upgrades / hoisting).\n 'react-redux',\n '@reduxjs/toolkit',\n // Pre-bundle design-system so plugin custom field chunks (dynamic imports) resolve\n // to the same instance as the main app. Otherwise TooltipProvider/DesignSystemProvider\n // context from the root is not seen by components in plugin chunks.\n // Omit when linked so local changes are picked up (see exclude above)\n ...(!designSystemLinked ? ['@strapi/design-system'] : []),\n '@radix-ui/react-tooltip',\n // Pre-bundle lodash: design-system uses named imports (e.g. assignWith) but lodash\n // is CommonJS-only; pre-bundling converts it to ESM for the browser\n 'lodash',\n // Pre-bundle prismjs so plugin chunks get a valid ESM namespace (prismjs is UMD and can\n // otherwise expose an empty object when bundled, causing \"Prism is not defined\" in admin).\n 'prismjs',\n /**\n * Pre-bundle other dependencies that would otherwise cause a page reload when imported.\n * See \"performance\" section: https://vite.dev/guide/dep-pre-bundling.html#the-why\n * Only include dependencies for our internal example apps, otherwise it will break\n * real user apps that may not have those dependencies.\n */\n ...(isMonorepoExampleApp\n ? [\n '@dnd-kit/core',\n '@dnd-kit/sortable',\n '@dnd-kit/utilities',\n '@dnd-kit/modifiers',\n '@radix-ui/react-toolbar',\n 'codemirror5',\n 'codemirror5/addon/display/placeholder',\n 'date-fns-tz',\n 'date-fns/format',\n 'date-fns/formatISO',\n 'highlight.js',\n 'lodash/capitalize',\n 'lodash/fp',\n 'lodash/groupBy',\n 'lodash/has',\n 'lodash/isNil',\n 'lodash/locale',\n 'lodash/map',\n 'lodash/mapValues',\n 'lodash/pull',\n 'lodash/size',\n 'lodash/sortBy',\n 'lodash/tail',\n 'lodash/toLower',\n 'lodash/toNumber',\n 'lodash/toString',\n 'lodash/truncate',\n 'lodash/uniq',\n 'lodash/upperFirst',\n 'markdown-it',\n 'markdown-it-abbr',\n 'markdown-it-container',\n 'markdown-it-deflist',\n 'markdown-it-emoji',\n 'markdown-it-footnote',\n 'markdown-it-ins',\n 'markdown-it-mark',\n 'markdown-it-sub',\n 'markdown-it-sup',\n 'prismjs/components/*.js',\n 'react-colorful',\n 'react-dnd-html5-backend',\n 'react-window',\n 'semver',\n 'semver/functions/lt',\n 'semver/functions/valid',\n 'slate',\n 'slate-history',\n 'slate-react',\n 'motion',\n ]\n : []),\n ],\n },\n resolve: {\n // https://react.dev/warnings/invalid-hook-call-warning#duplicate-react\n // Include design-system so plugin chunks use the same instance and inherit root context\n dedupe: [\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 ],\n // Explicit aliases ensure resolution under pnpm's strict dependency isolation,\n // where packages imported by plugins may not be resolvable from plugin chunks\n alias: {\n react: getModulePath('react'),\n 'react-dom': getModulePath('react-dom'),\n 'react-router-dom': getModulePath('react-router-dom'),\n 'styled-components': getModulePath('styled-components'),\n 'react-redux': getModulePath('react-redux'),\n '@reduxjs/toolkit': getModulePath('@reduxjs/toolkit'),\n '@strapi/design-system': getModulePath('@strapi/design-system'),\n '@radix-ui/react-tooltip': getModulePath('@radix-ui/react-tooltip'),\n lodash: getModulePath('lodash'),\n },\n },\n plugins: [react(), buildFilesPlugin(ctx)],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const {\n options: { minify, sourcemaps },\n } = ctx;\n\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n logLevel: 'silent',\n mode: 'production',\n build: {\n ...baseConfig.build,\n assetsDir: '',\n minify,\n sourcemap: sourcemaps,\n rollupOptions: {\n input: {\n strapi: ctx.entry,\n },\n },\n },\n };\n};\n\nconst resolveDevelopmentConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const monorepo = await loadStrapiMonorepo(ctx.cwd);\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n mode: 'development',\n resolve: {\n ...baseConfig.resolve,\n alias: {\n ...baseConfig.resolve?.alias,\n ...getMonorepoAliases({ monorepo }),\n },\n },\n server: {\n cors: false,\n middlewareMode: true,\n open: ctx.options.open,\n hmr: {\n overlay: false,\n server: ctx.options.hmrServer,\n clientPort: ctx.options.hmrClientPort,\n },\n },\n appType: 'custom',\n };\n};\n\nconst USER_CONFIGS = ['vite.config.js', 'vite.config.mjs', 'vite.config.ts', 'vite.config.mts'];\n\ntype UserViteConfig = (config: UserConfig) => UserConfig;\n\nconst mergeConfigWithUserConfig = async (config: InlineConfig, ctx: BuildContext) => {\n const userConfig = await getUserConfig<UserViteConfig>(USER_CONFIGS, ctx);\n\n if (userConfig) {\n return userConfig(config);\n }\n\n return config;\n};\n\nexport { mergeConfigWithUserConfig, resolveProductionConfig, resolveDevelopmentConfig };\n"],"names":["resolveBaseConfig","ctx","default","browserslistToEsbuild","target","isMonorepoExampleApp","strapi","internal_config","uuid","designSystemLinked","isDesignSystemLinked","root","cwd","base","basePath","build","emptyOutDir","outDir","distDir","cacheDir","configFile","define","process","JSON","stringify","env","envPrefix","optimizeDeps","exclude","include","resolve","dedupe","alias","react","getModulePath","lodash","plugins","buildFilesPlugin","resolveProductionConfig","options","minify","sourcemaps","baseConfig","logLevel","mode","assetsDir","sourcemap","rollupOptions","input","entry","resolveDevelopmentConfig","monorepo","loadStrapiMonorepo","getMonorepoAliases","server","cors","middlewareMode","open","hmr","overlay","hmrServer","clientPort","hmrClientPort","appType","USER_CONFIGS","mergeConfigWithUserConfig","config","userConfig","getUserConfig"],"mappings":";;;;;;;;AAWA,MAAMA,oBAAoB,OAAOC,GAAAA,GAAAA;AAC/B,IAAA,MAAM,EAAEC,OAAAA,EAASC,qBAAqB,EAAE,GAAG,MAAM,OA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,UAAU;QACbE,IAAAA,EAAM,aAAA;QACNd,OAAAA,EAAS;AACP,YAAA,GAAGY,WAAWZ,OAAO;YACrBE,KAAAA,EAAO;gBACL,GAAGU,UAAAA,CAAWZ,OAAO,EAAEE,KAAK;AAC5B,gBAAA,GAAGqB,kBAAAA,CAAmB;AAAEF,oBAAAA;iBAAS;AACnC;AACF,SAAA;QACAG,MAAAA,EAAQ;YACNC,IAAAA,EAAM,KAAA;YACNC,cAAAA,EAAgB,IAAA;YAChBC,IAAAA,EAAMxD,GAAAA,CAAIsC,OAAO,CAACkB,IAAI;YACtBC,GAAAA,EAAK;gBACHC,OAAAA,EAAS,KAAA;gBACTL,MAAAA,EAAQrD,GAAAA,CAAIsC,OAAO,CAACqB,SAAS;gBAC7BC,UAAAA,EAAY5D,GAAAA,CAAIsC,OAAO,CAACuB;AAC1B;AACF,SAAA;QACAC,OAAAA,EAAS;AACX,KAAA;AACF;AAEA,MAAMC,YAAAA,GAAe;AAAC,IAAA,gBAAA;AAAkB,IAAA,iBAAA;AAAmB,IAAA,gBAAA;AAAkB,IAAA;AAAkB,CAAA;AAI/F,MAAMC,yBAAAA,GAA4B,OAAOC,MAAAA,EAAsBjE,GAAAA,GAAAA;IAC7D,MAAMkE,UAAAA,GAAa,MAAMC,aAAAA,CAA8BJ,YAAAA,EAAc/D,GAAAA,CAAAA;AAErE,IAAA,IAAIkE,UAAAA,EAAY;AACd,QAAA,OAAOA,UAAAA,CAAWD,MAAAA,CAAAA;AACpB,IAAA;IAEA,OAAOA,MAAAA;AACT;;;;"}
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
4
- var browserslistToEsbuild = require('browserslist-to-esbuild');
5
4
  var esbuildLoader = require('esbuild-loader');
6
5
  var ForkTsCheckerPlugin = require('fork-ts-checker-webpack-plugin');
7
6
  var HtmlWebpackPlugin = require('html-webpack-plugin');
@@ -17,6 +16,7 @@ var aliases = require('../core/aliases.js');
17
16
  var resolveModule = require('../core/resolve-module.js');
18
17
 
19
18
  const resolveBaseConfig = async (ctx)=>{
19
+ const { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');
20
20
  const target = browserslistToEsbuild(ctx.target);
21
21
  return {
22
22
  experiments: {
@@ -189,6 +189,7 @@ const resolveDevelopmentConfig = async (ctx)=>{
189
189
  };
190
190
  };
191
191
  const resolveProductionConfig = async (ctx)=>{
192
+ const { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');
192
193
  const target = browserslistToEsbuild(ctx.target);
193
194
  const baseConfig = await resolveBaseConfig(ctx);
194
195
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../../src/node/webpack/config.ts"],"sourcesContent":["import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';\nimport browserslistToEsbuild from 'browserslist-to-esbuild';\nimport { EsbuildPlugin } from 'esbuild-loader';\nimport ForkTsCheckerPlugin from 'fork-ts-checker-webpack-plugin';\nimport HtmlWebpackPlugin from 'html-webpack-plugin';\nimport MiniCssExtractPlugin from 'mini-css-extract-plugin';\nimport crypto from 'node:crypto';\nimport path from 'node:path';\nimport { Configuration, DefinePlugin, HotModuleReplacementPlugin } from 'webpack';\nimport { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';\n\nimport { loadStrapiMonorepo } from '../core/monorepo';\nimport type { BuildContext } from '../create-build-context';\nimport { getUserConfig } from '../core/config';\nimport { getLinkedDesignSystemPath } from '../core/linked-packages';\nimport { getMonorepoAliases } from '../core/aliases';\nimport { getModulePath } from '../core/resolve-module';\n\nconst resolveBaseConfig = async (ctx: BuildContext) => {\n const target = browserslistToEsbuild(ctx.target);\n\n return {\n experiments: {\n topLevelAwait: true,\n },\n entry: {\n main: [`./${ctx.entry}`],\n },\n resolve: {\n alias: {\n react: getModulePath('react'),\n 'react-dom': getModulePath('react-dom'),\n 'styled-components': getModulePath('styled-components'),\n 'react-router-dom': getModulePath('react-router-dom'),\n // Force single instance so plugin custom field chunks inherit root DesignSystemProvider context\n '@strapi/design-system': getModulePath('@strapi/design-system'),\n '@radix-ui/react-tooltip': getModulePath('@radix-ui/react-tooltip'),\n },\n extensions: ['.js', '.jsx', '.react.js', '.ts', '.tsx'],\n },\n module: {\n rules: [\n {\n test: /\\.(ts|tsx)$/,\n loader: require.resolve('esbuild-loader'),\n options: {\n loader: 'tsx',\n target,\n jsx: 'automatic',\n },\n },\n {\n test: /\\.(js|jsx|mjs)$/,\n use: {\n loader: require.resolve('esbuild-loader'),\n options: {\n loader: 'jsx',\n target,\n jsx: 'automatic',\n },\n },\n },\n {\n test: /\\.m?js/,\n resolve: {\n fullySpecified: false,\n },\n },\n {\n test: /\\.css$/i,\n use: [require.resolve('style-loader'), require.resolve('css-loader')],\n },\n {\n test: /\\.(svg|eot|otf|ttf|woff|woff2)$/,\n type: 'asset/resource',\n },\n {\n test: [/\\.bmp$/, /\\.gif$/, /\\.jpe?g$/, /\\.png$/, /\\.ico$/],\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: 1000,\n },\n },\n },\n {\n test: /\\.(mp4|webm)$/,\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: 10000,\n },\n },\n },\n ],\n },\n plugins: [\n new HtmlWebpackPlugin({\n inject: true,\n template: path.resolve(ctx.runtimeDir, 'index.html'),\n }),\n new DefinePlugin(\n Object.entries(ctx.env).reduce<Record<string, string>>((acc, [key, value]) => {\n acc[`process.env.${key}`] = JSON.stringify(value);\n return acc;\n }, {})\n ),\n ctx.tsconfig &&\n new ForkTsCheckerPlugin({\n typescript: {\n configFile: ctx.tsconfig.path,\n configOverwrite: {\n compilerOptions: {\n sourceMap: ctx.options.sourcemaps,\n },\n },\n },\n }),\n ].filter(Boolean),\n };\n};\n\nconst resolveDevelopmentConfig = async (ctx: BuildContext): Promise<Configuration> => {\n const baseConfig = await resolveBaseConfig(ctx);\n const monorepo = await loadStrapiMonorepo(ctx.cwd);\n const linkedDesignSystemPath = getLinkedDesignSystemPath();\n\n return {\n ...baseConfig,\n cache: {\n type: 'filesystem',\n // version cache when there are changes to aliases\n buildDependencies: {\n config: [__filename],\n // When design-system is linked, invalidate cache when it changes\n ...(linkedDesignSystemPath && {\n designSystem: [path.join(linkedDesignSystemPath, 'dist')],\n }),\n },\n version: crypto\n .createHash('md5')\n .update(Object.entries(baseConfig.resolve.alias ?? {}).join())\n .digest('hex'),\n },\n resolve: {\n ...baseConfig.resolve,\n alias: {\n ...baseConfig.resolve.alias,\n ...getMonorepoAliases({ monorepo }),\n },\n },\n entry: {\n ...baseConfig.entry,\n main: [\n `${require.resolve('webpack-hot-middleware/client')}?path=/__webpack_hmr`,\n ...baseConfig.entry.main,\n ],\n },\n stats: 'errors-warnings',\n mode: 'development',\n devtool: 'inline-source-map',\n output: {\n filename: '[name].js',\n path: ctx.distPath,\n publicPath: `${ctx.basePath.replace(/\\/$/, '')}/`,\n },\n infrastructureLogging: {\n level: 'error',\n },\n plugins: [\n ...baseConfig.plugins,\n new HotModuleReplacementPlugin(),\n new ReactRefreshWebpackPlugin(),\n ],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<Configuration> => {\n const target = browserslistToEsbuild(ctx.target);\n\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n stats: 'errors-only',\n mode: 'production',\n bail: true,\n devtool: ctx.options.sourcemaps ? 'source-map' : false,\n output: {\n path: ctx.distPath,\n publicPath: `${ctx.basePath.replace(/\\/$/, '')}/`,\n // Utilize long-term caching by adding content hashes (not compilation hashes)\n // to compiled assets for production\n filename: '[name].[contenthash:8].js',\n chunkFilename: '[name].[contenthash:8].chunk.js',\n },\n optimization: {\n minimize: ctx.options.minify,\n minimizer: [\n new EsbuildPlugin({\n target,\n css: true, // Apply minification to CSS assets\n }),\n ],\n moduleIds: 'deterministic',\n runtimeChunk: true,\n },\n plugins: [\n ...baseConfig.plugins,\n new MiniCssExtractPlugin({\n filename: '[name].[chunkhash].css',\n chunkFilename: '[name].[chunkhash].chunkhash.css',\n ignoreOrder: true,\n }),\n ctx.options.stats && new BundleAnalyzerPlugin(),\n ].filter(Boolean),\n };\n};\n\nconst USER_CONFIGS = ['webpack.config.js', 'webpack.config.mjs', 'webpack.config.ts'];\n\ntype UserWebpackConfig = (config: Configuration, webpack: unknown) => Configuration;\n\nconst mergeConfigWithUserConfig = async (config: Configuration, ctx: BuildContext) => {\n const userConfig = await getUserConfig<UserWebpackConfig>(USER_CONFIGS, ctx);\n\n if (userConfig) {\n if (typeof userConfig === 'function') {\n const webpack = await import('webpack');\n return userConfig(config, webpack);\n }\n\n ctx.logger.warn(\n `You've exported something other than a function from ${path.join(\n ctx.appDir,\n 'src',\n 'admin',\n 'webpack.config'\n )}, this will ignored.`\n );\n }\n\n return config;\n};\n\nexport { mergeConfigWithUserConfig, resolveDevelopmentConfig, resolveProductionConfig };\n"],"names":["resolveBaseConfig","ctx","target","browserslistToEsbuild","experiments","topLevelAwait","entry","main","resolve","alias","react","getModulePath","extensions","module","rules","test","loader","require","options","jsx","use","fullySpecified","type","parser","dataUrlCondition","maxSize","plugins","HtmlWebpackPlugin","inject","template","path","runtimeDir","DefinePlugin","Object","entries","env","reduce","acc","key","value","JSON","stringify","tsconfig","ForkTsCheckerPlugin","typescript","configFile","configOverwrite","compilerOptions","sourceMap","sourcemaps","filter","Boolean","resolveDevelopmentConfig","baseConfig","monorepo","loadStrapiMonorepo","cwd","linkedDesignSystemPath","getLinkedDesignSystemPath","cache","buildDependencies","config","__filename","designSystem","join","version","crypto","createHash","update","digest","getMonorepoAliases","stats","mode","devtool","output","filename","distPath","publicPath","basePath","replace","infrastructureLogging","level","HotModuleReplacementPlugin","ReactRefreshWebpackPlugin","resolveProductionConfig","bail","chunkFilename","optimization","minimize","minify","minimizer","EsbuildPlugin","css","moduleIds","runtimeChunk","MiniCssExtractPlugin","ignoreOrder","BundleAnalyzerPlugin","USER_CONFIGS","mergeConfigWithUserConfig","userConfig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7B,YAAA,OAAOF,WAAWvC,QAAAA,EAAQyC,OAAAA,CAAAA;AAC5B,QAAA;AAEArG,QAAAA,GAAAA,CAAIsG,MAAM,CAACC,IAAI,CACb,CAAC,qDAAqD,EAAE1E,IAAAA,CAAKkC,IAAI,CAC/D/D,IAAIwG,MAAM,EACV,OACA,OAAA,EACA,gBAAA,CAAA,CACA,oBAAoB,CAAC,CAAA;AAE3B,IAAA;IAEA,OAAO5C,QAAAA;AACT;;;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../../../src/node/webpack/config.ts"],"sourcesContent":["import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';\nimport { EsbuildPlugin } from 'esbuild-loader';\nimport ForkTsCheckerPlugin from 'fork-ts-checker-webpack-plugin';\nimport HtmlWebpackPlugin from 'html-webpack-plugin';\nimport MiniCssExtractPlugin from 'mini-css-extract-plugin';\nimport crypto from 'node:crypto';\nimport path from 'node:path';\nimport { Configuration, DefinePlugin, HotModuleReplacementPlugin } from 'webpack';\nimport { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';\n\nimport { loadStrapiMonorepo } from '../core/monorepo';\nimport type { BuildContext } from '../create-build-context';\nimport { getUserConfig } from '../core/config';\nimport { getLinkedDesignSystemPath } from '../core/linked-packages';\nimport { getMonorepoAliases } from '../core/aliases';\nimport { getModulePath } from '../core/resolve-module';\n\nconst resolveBaseConfig = async (ctx: BuildContext) => {\n const { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');\n const target = browserslistToEsbuild(ctx.target);\n\n return {\n experiments: {\n topLevelAwait: true,\n },\n entry: {\n main: [`./${ctx.entry}`],\n },\n resolve: {\n alias: {\n react: getModulePath('react'),\n 'react-dom': getModulePath('react-dom'),\n 'styled-components': getModulePath('styled-components'),\n 'react-router-dom': getModulePath('react-router-dom'),\n // Force single instance so plugin custom field chunks inherit root DesignSystemProvider context\n '@strapi/design-system': getModulePath('@strapi/design-system'),\n '@radix-ui/react-tooltip': getModulePath('@radix-ui/react-tooltip'),\n },\n extensions: ['.js', '.jsx', '.react.js', '.ts', '.tsx'],\n },\n module: {\n rules: [\n {\n test: /\\.(ts|tsx)$/,\n loader: require.resolve('esbuild-loader'),\n options: {\n loader: 'tsx',\n target,\n jsx: 'automatic',\n },\n },\n {\n test: /\\.(js|jsx|mjs)$/,\n use: {\n loader: require.resolve('esbuild-loader'),\n options: {\n loader: 'jsx',\n target,\n jsx: 'automatic',\n },\n },\n },\n {\n test: /\\.m?js/,\n resolve: {\n fullySpecified: false,\n },\n },\n {\n test: /\\.css$/i,\n use: [require.resolve('style-loader'), require.resolve('css-loader')],\n },\n {\n test: /\\.(svg|eot|otf|ttf|woff|woff2)$/,\n type: 'asset/resource',\n },\n {\n test: [/\\.bmp$/, /\\.gif$/, /\\.jpe?g$/, /\\.png$/, /\\.ico$/],\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: 1000,\n },\n },\n },\n {\n test: /\\.(mp4|webm)$/,\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: 10000,\n },\n },\n },\n ],\n },\n plugins: [\n new HtmlWebpackPlugin({\n inject: true,\n template: path.resolve(ctx.runtimeDir, 'index.html'),\n }),\n new DefinePlugin(\n Object.entries(ctx.env).reduce<Record<string, string>>((acc, [key, value]) => {\n acc[`process.env.${key}`] = JSON.stringify(value);\n return acc;\n }, {})\n ),\n ctx.tsconfig &&\n new ForkTsCheckerPlugin({\n typescript: {\n configFile: ctx.tsconfig.path,\n configOverwrite: {\n compilerOptions: {\n sourceMap: ctx.options.sourcemaps,\n },\n },\n },\n }),\n ].filter(Boolean),\n };\n};\n\nconst resolveDevelopmentConfig = async (ctx: BuildContext): Promise<Configuration> => {\n const baseConfig = await resolveBaseConfig(ctx);\n const monorepo = await loadStrapiMonorepo(ctx.cwd);\n const linkedDesignSystemPath = getLinkedDesignSystemPath();\n\n return {\n ...baseConfig,\n cache: {\n type: 'filesystem',\n // version cache when there are changes to aliases\n buildDependencies: {\n config: [__filename],\n // When design-system is linked, invalidate cache when it changes\n ...(linkedDesignSystemPath && {\n designSystem: [path.join(linkedDesignSystemPath, 'dist')],\n }),\n },\n version: crypto\n .createHash('md5')\n .update(Object.entries(baseConfig.resolve.alias ?? {}).join())\n .digest('hex'),\n },\n resolve: {\n ...baseConfig.resolve,\n alias: {\n ...baseConfig.resolve.alias,\n ...getMonorepoAliases({ monorepo }),\n },\n },\n entry: {\n ...baseConfig.entry,\n main: [\n `${require.resolve('webpack-hot-middleware/client')}?path=/__webpack_hmr`,\n ...baseConfig.entry.main,\n ],\n },\n stats: 'errors-warnings',\n mode: 'development',\n devtool: 'inline-source-map',\n output: {\n filename: '[name].js',\n path: ctx.distPath,\n publicPath: `${ctx.basePath.replace(/\\/$/, '')}/`,\n },\n infrastructureLogging: {\n level: 'error',\n },\n plugins: [\n ...baseConfig.plugins,\n new HotModuleReplacementPlugin(),\n new ReactRefreshWebpackPlugin(),\n ],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<Configuration> => {\n const { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');\n const target = browserslistToEsbuild(ctx.target);\n\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n stats: 'errors-only',\n mode: 'production',\n bail: true,\n devtool: ctx.options.sourcemaps ? 'source-map' : false,\n output: {\n path: ctx.distPath,\n publicPath: `${ctx.basePath.replace(/\\/$/, '')}/`,\n // Utilize long-term caching by adding content hashes (not compilation hashes)\n // to compiled assets for production\n filename: '[name].[contenthash:8].js',\n chunkFilename: '[name].[contenthash:8].chunk.js',\n },\n optimization: {\n minimize: ctx.options.minify,\n minimizer: [\n new EsbuildPlugin({\n target,\n css: true, // Apply minification to CSS assets\n }),\n ],\n moduleIds: 'deterministic',\n runtimeChunk: true,\n },\n plugins: [\n ...baseConfig.plugins,\n new MiniCssExtractPlugin({\n filename: '[name].[chunkhash].css',\n chunkFilename: '[name].[chunkhash].chunkhash.css',\n ignoreOrder: true,\n }),\n ctx.options.stats && new BundleAnalyzerPlugin(),\n ].filter(Boolean),\n };\n};\n\nconst USER_CONFIGS = ['webpack.config.js', 'webpack.config.mjs', 'webpack.config.ts'];\n\ntype UserWebpackConfig = (config: Configuration, webpack: unknown) => Configuration;\n\nconst mergeConfigWithUserConfig = async (config: Configuration, ctx: BuildContext) => {\n const userConfig = await getUserConfig<UserWebpackConfig>(USER_CONFIGS, ctx);\n\n if (userConfig) {\n if (typeof userConfig === 'function') {\n const webpack = await import('webpack');\n return userConfig(config, webpack);\n }\n\n ctx.logger.warn(\n `You've exported something other than a function from ${path.join(\n ctx.appDir,\n 'src',\n 'admin',\n 'webpack.config'\n )}, this will ignored.`\n );\n }\n\n return config;\n};\n\nexport { mergeConfigWithUserConfig, resolveDevelopmentConfig, resolveProductionConfig };\n"],"names":["resolveBaseConfig","ctx","default","browserslistToEsbuild","target","experiments","topLevelAwait","entry","main","resolve","alias","react","getModulePath","extensions","module","rules","test","loader","require","options","jsx","use","fullySpecified","type","parser","dataUrlCondition","maxSize","plugins","HtmlWebpackPlugin","inject","template","path","runtimeDir","DefinePlugin","Object","entries","env","reduce","acc","key","value","JSON","stringify","tsconfig","ForkTsCheckerPlugin","typescript","configFile","configOverwrite","compilerOptions","sourceMap","sourcemaps","filter","Boolean","resolveDevelopmentConfig","baseConfig","monorepo","loadStrapiMonorepo","cwd","linkedDesignSystemPath","getLinkedDesignSystemPath","cache","buildDependencies","config","__filename","designSystem","join","version","crypto","createHash","update","digest","getMonorepoAliases","stats","mode","devtool","output","filename","distPath","publicPath","basePath","replace","infrastructureLogging","level","HotModuleReplacementPlugin","ReactRefreshWebpackPlugin","resolveProductionConfig","bail","chunkFilename","optimization","minimize","minify","minimizer","EsbuildPlugin","css","moduleIds","runtimeChunk","MiniCssExtractPlugin","ignoreOrder","BundleAnalyzerPlugin","USER_CONFIGS","mergeConfigWithUserConfig","userConfig","getUserConfig","webpack","logger","warn","appDir"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAMA,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A,EAAY;QACd,IAAI,OAAOA,eAAe,UAAA,EAAY;YACpC,MAAME,OAAAA,GAAU,MAAM,OAAO,SAAA,CAAA;AAC7B,YAAA,OAAOF,WAAWvC,QAAAA,EAAQyC,OAAAA,CAAAA;AAC5B,QAAA;AAEAtG,QAAAA,GAAAA,CAAIuG,MAAM,CAACC,IAAI,CACb,CAAC,qDAAqD,EAAE1E,IAAAA,CAAKkC,IAAI,CAC/DhE,IAAIyG,MAAM,EACV,OACA,OAAA,EACA,gBAAA,CAAA,CACA,oBAAoB,CAAC,CAAA;AAE3B,IAAA;IAEA,OAAO5C,QAAAA;AACT;;;;;;"}
@@ -1,5 +1,4 @@
1
1
  import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
2
- import browserslistToEsbuild from 'browserslist-to-esbuild';
3
2
  import { EsbuildPlugin } from 'esbuild-loader';
4
3
  import ForkTsCheckerPlugin from 'fork-ts-checker-webpack-plugin';
5
4
  import HtmlWebpackPlugin from 'html-webpack-plugin';
@@ -15,6 +14,7 @@ import { getMonorepoAliases } from '../core/aliases.mjs';
15
14
  import { getModulePath } from '../core/resolve-module.mjs';
16
15
 
17
16
  const resolveBaseConfig = async (ctx)=>{
17
+ const { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');
18
18
  const target = browserslistToEsbuild(ctx.target);
19
19
  return {
20
20
  experiments: {
@@ -187,6 +187,7 @@ const resolveDevelopmentConfig = async (ctx)=>{
187
187
  };
188
188
  };
189
189
  const resolveProductionConfig = async (ctx)=>{
190
+ const { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');
190
191
  const target = browserslistToEsbuild(ctx.target);
191
192
  const baseConfig = await resolveBaseConfig(ctx);
192
193
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","sources":["../../../../src/node/webpack/config.ts"],"sourcesContent":["import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';\nimport browserslistToEsbuild from 'browserslist-to-esbuild';\nimport { EsbuildPlugin } from 'esbuild-loader';\nimport ForkTsCheckerPlugin from 'fork-ts-checker-webpack-plugin';\nimport HtmlWebpackPlugin from 'html-webpack-plugin';\nimport MiniCssExtractPlugin from 'mini-css-extract-plugin';\nimport crypto from 'node:crypto';\nimport path from 'node:path';\nimport { Configuration, DefinePlugin, HotModuleReplacementPlugin } from 'webpack';\nimport { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';\n\nimport { loadStrapiMonorepo } from '../core/monorepo';\nimport type { BuildContext } from '../create-build-context';\nimport { getUserConfig } from '../core/config';\nimport { getLinkedDesignSystemPath } from '../core/linked-packages';\nimport { getMonorepoAliases } from '../core/aliases';\nimport { getModulePath } from '../core/resolve-module';\n\nconst resolveBaseConfig = async (ctx: BuildContext) => {\n const target = browserslistToEsbuild(ctx.target);\n\n return {\n experiments: {\n topLevelAwait: true,\n },\n entry: {\n main: [`./${ctx.entry}`],\n },\n resolve: {\n alias: {\n react: getModulePath('react'),\n 'react-dom': getModulePath('react-dom'),\n 'styled-components': getModulePath('styled-components'),\n 'react-router-dom': getModulePath('react-router-dom'),\n // Force single instance so plugin custom field chunks inherit root DesignSystemProvider context\n '@strapi/design-system': getModulePath('@strapi/design-system'),\n '@radix-ui/react-tooltip': getModulePath('@radix-ui/react-tooltip'),\n },\n extensions: ['.js', '.jsx', '.react.js', '.ts', '.tsx'],\n },\n module: {\n rules: [\n {\n test: /\\.(ts|tsx)$/,\n loader: require.resolve('esbuild-loader'),\n options: {\n loader: 'tsx',\n target,\n jsx: 'automatic',\n },\n },\n {\n test: /\\.(js|jsx|mjs)$/,\n use: {\n loader: require.resolve('esbuild-loader'),\n options: {\n loader: 'jsx',\n target,\n jsx: 'automatic',\n },\n },\n },\n {\n test: /\\.m?js/,\n resolve: {\n fullySpecified: false,\n },\n },\n {\n test: /\\.css$/i,\n use: [require.resolve('style-loader'), require.resolve('css-loader')],\n },\n {\n test: /\\.(svg|eot|otf|ttf|woff|woff2)$/,\n type: 'asset/resource',\n },\n {\n test: [/\\.bmp$/, /\\.gif$/, /\\.jpe?g$/, /\\.png$/, /\\.ico$/],\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: 1000,\n },\n },\n },\n {\n test: /\\.(mp4|webm)$/,\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: 10000,\n },\n },\n },\n ],\n },\n plugins: [\n new HtmlWebpackPlugin({\n inject: true,\n template: path.resolve(ctx.runtimeDir, 'index.html'),\n }),\n new DefinePlugin(\n Object.entries(ctx.env).reduce<Record<string, string>>((acc, [key, value]) => {\n acc[`process.env.${key}`] = JSON.stringify(value);\n return acc;\n }, {})\n ),\n ctx.tsconfig &&\n new ForkTsCheckerPlugin({\n typescript: {\n configFile: ctx.tsconfig.path,\n configOverwrite: {\n compilerOptions: {\n sourceMap: ctx.options.sourcemaps,\n },\n },\n },\n }),\n ].filter(Boolean),\n };\n};\n\nconst resolveDevelopmentConfig = async (ctx: BuildContext): Promise<Configuration> => {\n const baseConfig = await resolveBaseConfig(ctx);\n const monorepo = await loadStrapiMonorepo(ctx.cwd);\n const linkedDesignSystemPath = getLinkedDesignSystemPath();\n\n return {\n ...baseConfig,\n cache: {\n type: 'filesystem',\n // version cache when there are changes to aliases\n buildDependencies: {\n config: [__filename],\n // When design-system is linked, invalidate cache when it changes\n ...(linkedDesignSystemPath && {\n designSystem: [path.join(linkedDesignSystemPath, 'dist')],\n }),\n },\n version: crypto\n .createHash('md5')\n .update(Object.entries(baseConfig.resolve.alias ?? {}).join())\n .digest('hex'),\n },\n resolve: {\n ...baseConfig.resolve,\n alias: {\n ...baseConfig.resolve.alias,\n ...getMonorepoAliases({ monorepo }),\n },\n },\n entry: {\n ...baseConfig.entry,\n main: [\n `${require.resolve('webpack-hot-middleware/client')}?path=/__webpack_hmr`,\n ...baseConfig.entry.main,\n ],\n },\n stats: 'errors-warnings',\n mode: 'development',\n devtool: 'inline-source-map',\n output: {\n filename: '[name].js',\n path: ctx.distPath,\n publicPath: `${ctx.basePath.replace(/\\/$/, '')}/`,\n },\n infrastructureLogging: {\n level: 'error',\n },\n plugins: [\n ...baseConfig.plugins,\n new HotModuleReplacementPlugin(),\n new ReactRefreshWebpackPlugin(),\n ],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<Configuration> => {\n const target = browserslistToEsbuild(ctx.target);\n\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n stats: 'errors-only',\n mode: 'production',\n bail: true,\n devtool: ctx.options.sourcemaps ? 'source-map' : false,\n output: {\n path: ctx.distPath,\n publicPath: `${ctx.basePath.replace(/\\/$/, '')}/`,\n // Utilize long-term caching by adding content hashes (not compilation hashes)\n // to compiled assets for production\n filename: '[name].[contenthash:8].js',\n chunkFilename: '[name].[contenthash:8].chunk.js',\n },\n optimization: {\n minimize: ctx.options.minify,\n minimizer: [\n new EsbuildPlugin({\n target,\n css: true, // Apply minification to CSS assets\n }),\n ],\n moduleIds: 'deterministic',\n runtimeChunk: true,\n },\n plugins: [\n ...baseConfig.plugins,\n new MiniCssExtractPlugin({\n filename: '[name].[chunkhash].css',\n chunkFilename: '[name].[chunkhash].chunkhash.css',\n ignoreOrder: true,\n }),\n ctx.options.stats && new BundleAnalyzerPlugin(),\n ].filter(Boolean),\n };\n};\n\nconst USER_CONFIGS = ['webpack.config.js', 'webpack.config.mjs', 'webpack.config.ts'];\n\ntype UserWebpackConfig = (config: Configuration, webpack: unknown) => Configuration;\n\nconst mergeConfigWithUserConfig = async (config: Configuration, ctx: BuildContext) => {\n const userConfig = await getUserConfig<UserWebpackConfig>(USER_CONFIGS, ctx);\n\n if (userConfig) {\n if (typeof userConfig === 'function') {\n const webpack = await import('webpack');\n return userConfig(config, webpack);\n }\n\n ctx.logger.warn(\n `You've exported something other than a function from ${path.join(\n ctx.appDir,\n 'src',\n 'admin',\n 'webpack.config'\n )}, this will ignored.`\n );\n }\n\n return config;\n};\n\nexport { mergeConfigWithUserConfig, resolveDevelopmentConfig, resolveProductionConfig };\n"],"names":["resolveBaseConfig","ctx","target","browserslistToEsbuild","experiments","topLevelAwait","entry","main","resolve","alias","react","getModulePath","extensions","module","rules","test","loader","require","options","jsx","use","fullySpecified","type","parser","dataUrlCondition","maxSize","plugins","HtmlWebpackPlugin","inject","template","path","runtimeDir","DefinePlugin","Object","entries","env","reduce","acc","key","value","JSON","stringify","tsconfig","ForkTsCheckerPlugin","typescript","configFile","configOverwrite","compilerOptions","sourceMap","sourcemaps","filter","Boolean","resolveDevelopmentConfig","baseConfig","monorepo","loadStrapiMonorepo","cwd","linkedDesignSystemPath","getLinkedDesignSystemPath","cache","buildDependencies","config","__filename","designSystem","join","version","crypto","createHash","update","digest","getMonorepoAliases","stats","mode","devtool","output","filename","distPath","publicPath","basePath","replace","infrastructureLogging","level","HotModuleReplacementPlugin","ReactRefreshWebpackPlugin","resolveProductionConfig","bail","chunkFilename","optimization","minimize","minify","minimizer","EsbuildPlugin","css","moduleIds","runtimeChunk","MiniCssExtractPlugin","ignoreOrder","BundleAnalyzerPlugin","USER_CONFIGS","mergeConfigWithUserConfig","userConfig","getUserConfig","webpack","logger","warn","appDir"],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAMA,oBAAoB,OAAOC,GAAAA,GAAAA;IAC/B,MAAMC,MAAAA,GAASC,qBAAAA,CAAsBF,GAAAA,CAAIC,MAAM,CAAA;IAE/C,OAAO;QACLE,WAAAA,EAAa;YACXC,aAAAA,EAAe;AACjB,SAAA;QACAC,KAAAA,EAAO;YACLC,IAAAA,EAAM;AAAC,gBAAA,CAAC,EAAE,EAAEN,GAAAA,CAAIK,KAAK,CAAA;AAAG;AAC1B,SAAA;QACAE,OAAAA,EAAS;YACPC,KAAAA,EAAO;AACLC,gBAAAA,KAAAA,EAAOC,aAAAA,CAAc,OAAA,CAAA;AACrB,gBAAA,WAAA,EAAaA,aAAAA,CAAc,WAAA,CAAA;AAC3B,gBAAA,mBAAA,EAAqBA,aAAAA,CAAc,mBAAA,CAAA;AACnC,gBAAA,kB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AAA,UAAAA,CAAW3B,OAAO;AACrB,YAAA,IAAIqE,oBAAAA,CAAqB;gBACvBpB,QAAAA,EAAU,wBAAA;gBACVW,aAAAA,EAAe,kCAAA;gBACfU,WAAAA,EAAa;AACf,aAAA,CAAA;AACA/F,YAAAA,GAAAA,CAAIiB,OAAO,CAACqD,KAAK,IAAI,IAAI0B,oBAAAA;AAC1B,SAAA,CAAC/C,MAAM,CAACC,OAAAA;AACX,KAAA;AACF;AAEA,MAAM+C,YAAAA,GAAe;AAAC,IAAA,mBAAA;AAAqB,IAAA,oBAAA;AAAsB,IAAA;AAAoB,CAAA;AAIrF,MAAMC,yBAAAA,GAA4B,OAAOtC,MAAAA,EAAuB5D,GAAAA,GAAAA;IAC9D,MAAMmG,UAAAA,GAAa,MAAMC,aAAAA,CAAiCH,YAAAA,EAAcjG,GAAAA,CAAAA;AAExE,IAAA,IAAImG,UAAAA,EAAY;QACd,IAAI,OAAOA,eAAe,UAAA,EAAY;YACpC,MAAME,OAAAA,GAAU,MAAM,OAAO,SAAA,CAAA;AAC7B,YAAA,OAAOF,WAAWvC,MAAAA,EAAQyC,OAAAA,CAAAA;AAC5B,QAAA;AAEArG,QAAAA,GAAAA,CAAIsG,MAAM,CAACC,IAAI,CACb,CAAC,qDAAqD,EAAE1E,IAAAA,CAAKkC,IAAI,CAC/D/D,IAAIwG,MAAM,EACV,OACA,OAAA,EACA,gBAAA,CAAA,CACA,oBAAoB,CAAC,CAAA;AAE3B,IAAA;IAEA,OAAO5C,MAAAA;AACT;;;;"}
1
+ {"version":3,"file":"config.mjs","sources":["../../../../src/node/webpack/config.ts"],"sourcesContent":["import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';\nimport { EsbuildPlugin } from 'esbuild-loader';\nimport ForkTsCheckerPlugin from 'fork-ts-checker-webpack-plugin';\nimport HtmlWebpackPlugin from 'html-webpack-plugin';\nimport MiniCssExtractPlugin from 'mini-css-extract-plugin';\nimport crypto from 'node:crypto';\nimport path from 'node:path';\nimport { Configuration, DefinePlugin, HotModuleReplacementPlugin } from 'webpack';\nimport { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';\n\nimport { loadStrapiMonorepo } from '../core/monorepo';\nimport type { BuildContext } from '../create-build-context';\nimport { getUserConfig } from '../core/config';\nimport { getLinkedDesignSystemPath } from '../core/linked-packages';\nimport { getMonorepoAliases } from '../core/aliases';\nimport { getModulePath } from '../core/resolve-module';\n\nconst resolveBaseConfig = async (ctx: BuildContext) => {\n const { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');\n const target = browserslistToEsbuild(ctx.target);\n\n return {\n experiments: {\n topLevelAwait: true,\n },\n entry: {\n main: [`./${ctx.entry}`],\n },\n resolve: {\n alias: {\n react: getModulePath('react'),\n 'react-dom': getModulePath('react-dom'),\n 'styled-components': getModulePath('styled-components'),\n 'react-router-dom': getModulePath('react-router-dom'),\n // Force single instance so plugin custom field chunks inherit root DesignSystemProvider context\n '@strapi/design-system': getModulePath('@strapi/design-system'),\n '@radix-ui/react-tooltip': getModulePath('@radix-ui/react-tooltip'),\n },\n extensions: ['.js', '.jsx', '.react.js', '.ts', '.tsx'],\n },\n module: {\n rules: [\n {\n test: /\\.(ts|tsx)$/,\n loader: require.resolve('esbuild-loader'),\n options: {\n loader: 'tsx',\n target,\n jsx: 'automatic',\n },\n },\n {\n test: /\\.(js|jsx|mjs)$/,\n use: {\n loader: require.resolve('esbuild-loader'),\n options: {\n loader: 'jsx',\n target,\n jsx: 'automatic',\n },\n },\n },\n {\n test: /\\.m?js/,\n resolve: {\n fullySpecified: false,\n },\n },\n {\n test: /\\.css$/i,\n use: [require.resolve('style-loader'), require.resolve('css-loader')],\n },\n {\n test: /\\.(svg|eot|otf|ttf|woff|woff2)$/,\n type: 'asset/resource',\n },\n {\n test: [/\\.bmp$/, /\\.gif$/, /\\.jpe?g$/, /\\.png$/, /\\.ico$/],\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: 1000,\n },\n },\n },\n {\n test: /\\.(mp4|webm)$/,\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: 10000,\n },\n },\n },\n ],\n },\n plugins: [\n new HtmlWebpackPlugin({\n inject: true,\n template: path.resolve(ctx.runtimeDir, 'index.html'),\n }),\n new DefinePlugin(\n Object.entries(ctx.env).reduce<Record<string, string>>((acc, [key, value]) => {\n acc[`process.env.${key}`] = JSON.stringify(value);\n return acc;\n }, {})\n ),\n ctx.tsconfig &&\n new ForkTsCheckerPlugin({\n typescript: {\n configFile: ctx.tsconfig.path,\n configOverwrite: {\n compilerOptions: {\n sourceMap: ctx.options.sourcemaps,\n },\n },\n },\n }),\n ].filter(Boolean),\n };\n};\n\nconst resolveDevelopmentConfig = async (ctx: BuildContext): Promise<Configuration> => {\n const baseConfig = await resolveBaseConfig(ctx);\n const monorepo = await loadStrapiMonorepo(ctx.cwd);\n const linkedDesignSystemPath = getLinkedDesignSystemPath();\n\n return {\n ...baseConfig,\n cache: {\n type: 'filesystem',\n // version cache when there are changes to aliases\n buildDependencies: {\n config: [__filename],\n // When design-system is linked, invalidate cache when it changes\n ...(linkedDesignSystemPath && {\n designSystem: [path.join(linkedDesignSystemPath, 'dist')],\n }),\n },\n version: crypto\n .createHash('md5')\n .update(Object.entries(baseConfig.resolve.alias ?? {}).join())\n .digest('hex'),\n },\n resolve: {\n ...baseConfig.resolve,\n alias: {\n ...baseConfig.resolve.alias,\n ...getMonorepoAliases({ monorepo }),\n },\n },\n entry: {\n ...baseConfig.entry,\n main: [\n `${require.resolve('webpack-hot-middleware/client')}?path=/__webpack_hmr`,\n ...baseConfig.entry.main,\n ],\n },\n stats: 'errors-warnings',\n mode: 'development',\n devtool: 'inline-source-map',\n output: {\n filename: '[name].js',\n path: ctx.distPath,\n publicPath: `${ctx.basePath.replace(/\\/$/, '')}/`,\n },\n infrastructureLogging: {\n level: 'error',\n },\n plugins: [\n ...baseConfig.plugins,\n new HotModuleReplacementPlugin(),\n new ReactRefreshWebpackPlugin(),\n ],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<Configuration> => {\n const { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');\n const target = browserslistToEsbuild(ctx.target);\n\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n stats: 'errors-only',\n mode: 'production',\n bail: true,\n devtool: ctx.options.sourcemaps ? 'source-map' : false,\n output: {\n path: ctx.distPath,\n publicPath: `${ctx.basePath.replace(/\\/$/, '')}/`,\n // Utilize long-term caching by adding content hashes (not compilation hashes)\n // to compiled assets for production\n filename: '[name].[contenthash:8].js',\n chunkFilename: '[name].[contenthash:8].chunk.js',\n },\n optimization: {\n minimize: ctx.options.minify,\n minimizer: [\n new EsbuildPlugin({\n target,\n css: true, // Apply minification to CSS assets\n }),\n ],\n moduleIds: 'deterministic',\n runtimeChunk: true,\n },\n plugins: [\n ...baseConfig.plugins,\n new MiniCssExtractPlugin({\n filename: '[name].[chunkhash].css',\n chunkFilename: '[name].[chunkhash].chunkhash.css',\n ignoreOrder: true,\n }),\n ctx.options.stats && new BundleAnalyzerPlugin(),\n ].filter(Boolean),\n };\n};\n\nconst USER_CONFIGS = ['webpack.config.js', 'webpack.config.mjs', 'webpack.config.ts'];\n\ntype UserWebpackConfig = (config: Configuration, webpack: unknown) => Configuration;\n\nconst mergeConfigWithUserConfig = async (config: Configuration, ctx: BuildContext) => {\n const userConfig = await getUserConfig<UserWebpackConfig>(USER_CONFIGS, ctx);\n\n if (userConfig) {\n if (typeof userConfig === 'function') {\n const webpack = await import('webpack');\n return userConfig(config, webpack);\n }\n\n ctx.logger.warn(\n `You've exported something other than a function from ${path.join(\n ctx.appDir,\n 'src',\n 'admin',\n 'webpack.config'\n )}, this will ignored.`\n );\n }\n\n return config;\n};\n\nexport { mergeConfigWithUserConfig, resolveDevelopmentConfig, resolveProductionConfig };\n"],"names":["resolveBaseConfig","ctx","default","browserslistToEsbuild","target","experiments","topLevelAwait","entry","main","resolve","alias","react","getModulePath","extensions","module","rules","test","loader","require","options","jsx","use","fullySpecified","type","parser","dataUrlCondition","maxSize","plugins","HtmlWebpackPlugin","inject","template","path","runtimeDir","DefinePlugin","Object","entries","env","reduce","acc","key","value","JSON","stringify","tsconfig","ForkTsCheckerPlugin","typescript","configFile","configOverwrite","compilerOptions","sourceMap","sourcemaps","filter","Boolean","resolveDevelopmentConfig","baseConfig","monorepo","loadStrapiMonorepo","cwd","linkedDesignSystemPath","getLinkedDesignSystemPath","cache","buildDependencies","config","__filename","designSystem","join","version","crypto","createHash","update","digest","getMonorepoAliases","stats","mode","devtool","output","filename","distPath","publicPath","basePath","replace","infrastructureLogging","level","HotModuleReplacementPlugin","ReactRefreshWebpackPlugin","resolveProductionConfig","bail","chunkFilename","optimization","minimize","minify","minimizer","EsbuildPlugin","css","moduleIds","runtimeChunk","MiniCssExtractPlugin","ignoreOrder","BundleAnalyzerPlugin","USER_CONFIGS","mergeConfigWithUserConfig","userConfig","getUserConfig","webpack","logger","warn","appDir"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAMA,oBAAoB,OAAOC,GAAAA,GAAAA;AAC/B,IAAA,MAAM,EAAEC,OAAAA,EAASC,qBAAqB,EAAE,GAAG,MAAM,OAAO,yBAAA,CAAA;IACxD,MAAMC,MAAAA,GAASD,qBAAAA,CAAsBF,GAAAA,CAAIG,MAAM,CAAA;IAE/C,OAAO;QACLC,WAAAA,EAAa;YACXC,aAAAA,EAAe;AACjB,SAAA;QACAC,KAAAA,EAAO;YACLC,IAAAA,EAAM;AAAC,gBAAA,CAAC,EAAE,EAAEP,GAAAA,CAAIM,KAAK,CAAA;AAAG;AAC1B,SAAA;QACAE,OAAAA,EAAS;YACPC,KAAAA,EAAO;AACLC,gBAAAA,KAAAA,EAAOC,aAAAA,CAAc,OAAA,CAAA;AACrB,gBAAA,WAAA,EAAaA,aAAAA,CAAc,WAAA,CAAA;AAC3B,gBAAA,mBAAA,EAAqBA,aAAAA,CAAc,mBAAA,CAAA;AACnC,gBAAA,k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AA,EAAW,eAAA;YACXC,YAAAA,EAAc;AAChB,SAAA;QACApE,OAAAA,EAAS;AACJ2B,YAAAA,GAAAA,UAAAA,CAAW3B,OAAO;AACrB,YAAA,IAAIqE,oBAAAA,CAAqB;gBACvBpB,QAAAA,EAAU,wBAAA;gBACVW,aAAAA,EAAe,kCAAA;gBACfU,WAAAA,EAAa;AACf,aAAA,CAAA;AACAhG,YAAAA,GAAAA,CAAIkB,OAAO,CAACqD,KAAK,IAAI,IAAI0B,oBAAAA;AAC1B,SAAA,CAAC/C,MAAM,CAACC,OAAAA;AACX,KAAA;AACF;AAEA,MAAM+C,YAAAA,GAAe;AAAC,IAAA,mBAAA;AAAqB,IAAA,oBAAA;AAAsB,IAAA;AAAoB,CAAA;AAIrF,MAAMC,yBAAAA,GAA4B,OAAOtC,MAAAA,EAAuB7D,GAAAA,GAAAA;IAC9D,MAAMoG,UAAAA,GAAa,MAAMC,aAAAA,CAAiCH,YAAAA,EAAclG,GAAAA,CAAAA;AAExE,IAAA,IAAIoG,UAAAA,EAAY;QACd,IAAI,OAAOA,eAAe,UAAA,EAAY;YACpC,MAAME,OAAAA,GAAU,MAAM,OAAO,SAAA,CAAA;AAC7B,YAAA,OAAOF,WAAWvC,MAAAA,EAAQyC,OAAAA,CAAAA;AAC5B,QAAA;AAEAtG,QAAAA,GAAAA,CAAIuG,MAAM,CAACC,IAAI,CACb,CAAC,qDAAqD,EAAE1E,IAAAA,CAAKkC,IAAI,CAC/DhE,IAAIyG,MAAM,EACV,OACA,OAAA,EACA,gBAAA,CAAA,CACA,oBAAoB,CAAC,CAAA;AAE3B,IAAA;IAEA,OAAO5C,MAAAA;AACT;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "5.48.0",
3
+ "version": "5.48.1",
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,30 +109,30 @@
109
109
  },
110
110
  "dependencies": {
111
111
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.17",
112
- "@strapi/admin": "5.48.0",
113
- "@strapi/cloud-cli": "5.48.0",
114
- "@strapi/content-manager": "5.48.0",
115
- "@strapi/content-releases": "5.48.0",
116
- "@strapi/content-type-builder": "5.48.0",
117
- "@strapi/core": "5.48.0",
118
- "@strapi/data-transfer": "5.48.0",
119
- "@strapi/database": "5.48.0",
120
- "@strapi/email": "5.48.0",
121
- "@strapi/generators": "5.48.0",
122
- "@strapi/i18n": "5.48.0",
123
- "@strapi/logger": "5.48.0",
124
- "@strapi/openapi": "5.48.0",
125
- "@strapi/permissions": "5.48.0",
126
- "@strapi/review-workflows": "5.48.0",
127
- "@strapi/types": "5.48.0",
128
- "@strapi/typescript-utils": "5.48.0",
129
- "@strapi/upload": "5.48.0",
130
- "@strapi/utils": "5.48.0",
112
+ "@strapi/admin": "5.48.1",
113
+ "@strapi/cloud-cli": "5.48.1",
114
+ "@strapi/content-manager": "5.48.1",
115
+ "@strapi/content-releases": "5.48.1",
116
+ "@strapi/content-type-builder": "5.48.1",
117
+ "@strapi/core": "5.48.1",
118
+ "@strapi/data-transfer": "5.48.1",
119
+ "@strapi/database": "5.48.1",
120
+ "@strapi/email": "5.48.1",
121
+ "@strapi/generators": "5.48.1",
122
+ "@strapi/i18n": "5.48.1",
123
+ "@strapi/logger": "5.48.1",
124
+ "@strapi/openapi": "5.48.1",
125
+ "@strapi/permissions": "5.48.1",
126
+ "@strapi/review-workflows": "5.48.1",
127
+ "@strapi/types": "5.48.1",
128
+ "@strapi/typescript-utils": "5.48.1",
129
+ "@strapi/upload": "5.48.1",
130
+ "@strapi/utils": "5.48.1",
131
131
  "@types/nodemon": "1.19.6",
132
- "@vitejs/plugin-react-swc": "3.6.0",
132
+ "@vitejs/plugin-react-swc": "3.11.0",
133
133
  "boxen": "5.1.2",
134
134
  "browserslist": "^4.23.0",
135
- "browserslist-to-esbuild": "1.2.0",
135
+ "browserslist-to-esbuild": "2.1.1",
136
136
  "chalk": "4.1.2",
137
137
  "chokidar": "3.6.0",
138
138
  "ci-info": "4.0.0",
@@ -179,12 +179,12 @@
179
179
  "@types/lodash": "^4.14.191",
180
180
  "@types/node": "24.10.0",
181
181
  "@types/webpack-bundle-analyzer": "4.7.0",
182
- "@types/webpack-hot-middleware": "2.25.9",
183
- "eslint-config-custom": "5.48.0",
182
+ "@types/webpack-hot-middleware": "2.25.12",
183
+ "eslint-config-custom": "5.48.1",
184
184
  "jest": "29.6.0",
185
185
  "react": "18.3.1",
186
186
  "react-dom": "18.3.1",
187
- "tsconfig": "5.48.0",
187
+ "tsconfig": "5.48.1",
188
188
  "yalc": "1.0.0-pre.53"
189
189
  },
190
190
  "peerDependencies": {
@@ -194,7 +194,7 @@
194
194
  "styled-components": "^6.0.0"
195
195
  },
196
196
  "engines": {
197
- "node": ">=20.0.0 <=24.x.x",
197
+ "node": ">=20.0.0 <=26.x.x",
198
198
  "npm": ">=6.0.0"
199
199
  }
200
200
  }