@strapi/strapi 5.55.0 → 5.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin-styles.css +5 -0
- package/dist/node/core/admin-vite-aliases.d.ts +9 -0
- package/dist/node/core/admin-vite-aliases.d.ts.map +1 -1
- package/dist/node/core/aliases.d.ts +4 -1
- package/dist/node/core/aliases.d.ts.map +1 -1
- package/dist/node/core/scan-roots.d.ts +20 -0
- package/dist/node/core/scan-roots.d.ts.map +1 -0
- package/dist/node/create-build-context.d.ts +10 -1
- package/dist/node/create-build-context.d.ts.map +1 -1
- package/dist/node/develop.d.ts.map +1 -1
- package/dist/node/staticFiles.d.ts +3 -1
- package/dist/node/staticFiles.d.ts.map +1 -1
- package/dist/node/vite/config.d.ts.map +1 -1
- package/dist/node/vite/plugins.d.ts +2 -1
- package/dist/node/vite/plugins.d.ts.map +1 -1
- package/dist/node/vite/plugins.test.d.ts +2 -0
- package/dist/node/vite/plugins.test.d.ts.map +1 -0
- package/dist/package.json.js +1 -1
- package/dist/package.json.mjs +1 -1
- package/dist/src/node/core/admin-vite-aliases.js +51 -0
- package/dist/src/node/core/admin-vite-aliases.js.map +1 -1
- package/dist/src/node/core/admin-vite-aliases.mjs +46 -1
- package/dist/src/node/core/admin-vite-aliases.mjs.map +1 -1
- package/dist/src/node/core/aliases.js +6 -0
- package/dist/src/node/core/aliases.js.map +1 -1
- package/dist/src/node/core/aliases.mjs +6 -1
- package/dist/src/node/core/aliases.mjs.map +1 -1
- package/dist/src/node/core/scan-roots.js +87 -0
- package/dist/src/node/core/scan-roots.js.map +1 -0
- package/dist/src/node/core/scan-roots.mjs +79 -0
- package/dist/src/node/core/scan-roots.mjs.map +1 -0
- package/dist/src/node/create-build-context.js +40 -1
- package/dist/src/node/create-build-context.js.map +1 -1
- package/dist/src/node/create-build-context.mjs +40 -1
- package/dist/src/node/create-build-context.mjs.map +1 -1
- package/dist/src/node/develop.js +2 -1
- package/dist/src/node/develop.js.map +1 -1
- package/dist/src/node/develop.mjs +2 -1
- package/dist/src/node/develop.mjs.map +1 -1
- package/dist/src/node/staticFiles.js +43 -0
- package/dist/src/node/staticFiles.js.map +1 -1
- package/dist/src/node/staticFiles.mjs +42 -1
- package/dist/src/node/staticFiles.mjs.map +1 -1
- package/dist/src/node/vite/config.js +12 -1
- package/dist/src/node/vite/config.js.map +1 -1
- package/dist/src/node/vite/config.mjs +8 -1
- package/dist/src/node/vite/config.mjs.map +1 -1
- package/dist/src/node/vite/plugins.js +27 -1
- package/dist/src/node/vite/plugins.js.map +1 -1
- package/dist/src/node/vite/plugins.mjs +23 -1
- package/dist/src/node/vite/plugins.mjs.map +1 -1
- package/package.json +30 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","sources":["../../../../src/node/vite/config.ts"],"sourcesContent":["import type { InlineConfig, UserConfig } from 'vite';\n\nimport { getUserConfig } from '../core/config';\nimport { ADMIN_VITE_DEDUPE_MODULES } from '../core/admin-vite-alias-modules';\nimport {\n buildAdminViteResolveAliases,\n getResolvableSingletonModules,\n} from '../core/admin-vite-aliases';\nimport { collectAdminOptimizeDepsExclude } from '../core/admin-vite-optimize-exclude';\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 const pluginOptimizeDepsExclude = await collectAdminOptimizeDepsExclude(ctx.cwd, ctx.plugins);\n const optimizeDepsExclude = [\n ...(designSystemLinked ? ['@strapi/design-system'] : []),\n ...pluginOptimizeDepsExclude,\n ];\n\n // Imported dynamically so this file's CJS build resolves Vite's ESM Node API instead of\n // its CJS entry, which emits \"The CJS build of Vite's Node API is deprecated\".\n // https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated\n const { default: react } = await import('@vitejs/plugin-react-swc');\n\n return {\n root: ctx.cwd,\n base: ctx.basePath,\n // Public files are served by the strapi::public middleware at runtime, so they do not need to\n // be copied into the admin build output.\n publicDir: false,\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 // Contract (#26964, #26944, #27014):\n // - CJS packages imported by @strapi/admin MUST be in optimizeDeps.include (invariant, lodash, …).\n // - The admin entry host (@strapi/strapi) MUST NOT be in optimizeDeps.exclude.\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 // Also skip allowlisted / opt-in pre-built ESM plugin UI kits (see collectAdminOptimizeDepsExclude).\n ...(optimizeDepsExclude.length > 0 && { exclude: optimizeDepsExclude }),\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 // CJS-only; required for @strapi/admin in dev (#26944, #26964, #27014).\n 'lodash',\n 'invariant',\n // UMD; without pre-bundling plugin chunks get empty namespace → \"Prism is not defined\" (#26964).\n 'prismjs',\n // Do NOT add `prismjs/components/*.js` to include. #26978 prebundled every language for\n // all apps; combined with #27014's optimizeDeps contract, Vite evaluates those chunks in\n // reverse import order so parents (e.g. basic before vbnet) load too late →\n // `Cannot set properties of undefined (setting 'comment')` and a blank admin in develop.\n // Keep `prismjs` only; let language components load as normal ESM side-effect imports.\n // CodeMirror must be a single instance across design-system, lang-json and uiw or the\n // JSON custom field crashes on instanceof checks. Pre-bundle for every build — dev and\n // production — not only monorepo examples. Use the resolvable subset so include stays in\n // lockstep with resolve.alias (an unresolvable singleton must not be forced into pre-bundling).\n ...getResolvableSingletonModules(),\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 '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: [...ADMIN_VITE_DEDUPE_MODULES],\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: buildAdminViteResolveAliases(),\n },\n plugins: [react(), buildFilesPlugin(ctx)],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const {\n options: { minify, sourcemap },\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,\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 /**\n * In middleware mode Strapi forwards the browser Host from reverse proxies (nginx, Traefik).\n * Vite 5+ blocks unknown hosts unless explicitly allowed (#23491).\n */\n allowedHosts: true,\n middlewareMode: true,\n open: ctx.options.open,\n hmr: {\n overlay: false,\n /**\n * Use Strapi's http.Server so HMR websockets reuse the app's listen port. A separate listener\n * plus clientPort pushes browsers toward host:5173-style URLs that fail behind proxies that\n * only expose the Strapi server port (#23491, #23008).\n */\n server: ctx.strapi.server.httpServer,\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","pluginOptimizeDepsExclude","collectAdminOptimizeDepsExclude","cwd","plugins","optimizeDepsExclude","react","root","base","basePath","publicDir","build","emptyOutDir","outDir","distDir","cacheDir","configFile","define","process","JSON","stringify","env","envPrefix","optimizeDeps","length","exclude","include","getResolvableSingletonModules","resolve","dedupe","ADMIN_VITE_DEDUPE_MODULES","alias","buildAdminViteResolveAliases","buildFilesPlugin","resolveProductionConfig","options","minify","sourcemap","baseConfig","logLevel","mode","assetsDir","rollupOptions","input","entry","resolveDevelopmentConfig","monorepo","loadStrapiMonorepo","getMonorepoAliases","server","cors","allowedHosts","middlewareMode","open","hmr","overlay","httpServer","appType","USER_CONFIGS","mergeConfigWithUserConfig","config","userConfig","getUserConfig"],"mappings":";;;;;;;;;AAeA,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,oBAAAA,EAAAA;AAC3B,IAAA,MAAMC,4BAA4B,MAAMC,+BAAAA,C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CAACqD,MAAM,CAACO;AAC5B;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,EAAsBrE,GAAAA,GAAAA;IAC7D,MAAMsE,UAAAA,GAAa,MAAMC,aAAAA,CAA8BJ,YAAAA,EAAcnE,GAAAA,CAAAA;AAErE,IAAA,IAAIsE,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 path from 'node:path';\n\nimport type { InlineConfig, UserConfig } from 'vite';\n\nimport { getUserConfig } from '../core/config';\nimport { ADMIN_VITE_DEDUPE_MODULES } from '../core/admin-vite-alias-modules';\nimport {\n buildAdminViteResolveAliases,\n getResolvableSingletonModules,\n} from '../core/admin-vite-aliases';\nimport { collectAdminOptimizeDepsExclude } from '../core/admin-vite-optimize-exclude';\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 const pluginOptimizeDepsExclude = await collectAdminOptimizeDepsExclude(ctx.cwd, ctx.plugins);\n const optimizeDepsExclude = [\n ...(designSystemLinked ? ['@strapi/design-system'] : []),\n ...pluginOptimizeDepsExclude,\n ];\n\n // Imported dynamically so this file's CJS build resolves Vite's ESM Node API instead of\n // its CJS entry, which emits \"The CJS build of Vite's Node API is deprecated\".\n // https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated\n const { default: react } = await import('@vitejs/plugin-react-swc');\n\n // Imported dynamically so a flag-off build never loads the native oxide and lightningcss binaries\n // Make it a static import again when the flag goes\n const tailwindPlugins = ctx.nextDesignSystem\n ? [(await import('@tailwindcss/vite')).default()]\n : [];\n\n return {\n root: ctx.cwd,\n base: ctx.basePath,\n // Public files are served by the strapi::public middleware at runtime, so they do not need to\n // be copied into the admin build output.\n publicDir: false,\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 // Contract (#26964, #26944, #27014):\n // - CJS packages imported by @strapi/admin MUST be in optimizeDeps.include (invariant, lodash, …).\n // - The admin entry host (@strapi/strapi) MUST NOT be in optimizeDeps.exclude.\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 // Also skip allowlisted / opt-in pre-built ESM plugin UI kits (see collectAdminOptimizeDepsExclude).\n ...(optimizeDepsExclude.length > 0 && { exclude: optimizeDepsExclude }),\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 // CJS-only; required for @strapi/admin in dev (#26944, #26964, #27014).\n 'lodash',\n 'invariant',\n // UMD; without pre-bundling plugin chunks get empty namespace → \"Prism is not defined\" (#26964).\n 'prismjs',\n // Do NOT add `prismjs/components/*.js` to include. #26978 prebundled every language for\n // all apps; combined with #27014's optimizeDeps contract, Vite evaluates those chunks in\n // reverse import order so parents (e.g. basic before vbnet) load too late →\n // `Cannot set properties of undefined (setting 'comment')` and a blank admin in develop.\n // Keep `prismjs` only; let language components load as normal ESM side-effect imports.\n // CodeMirror must be a single instance across design-system, lang-json and uiw or the\n // JSON custom field crashes on instanceof checks. Pre-bundle for every build — dev and\n // production — not only monorepo examples. Use the resolvable subset so include stays in\n // lockstep with resolve.alias (an unresolvable singleton must not be forced into pre-bundling).\n ...getResolvableSingletonModules(),\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 '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: [...ADMIN_VITE_DEDUPE_MODULES],\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: buildAdminViteResolveAliases(),\n },\n plugins: [...tailwindPlugins, react(), buildFilesPlugin(ctx)],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const {\n options: { minify, sourcemap },\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,\n rollupOptions: {\n input: {\n strapi: ctx.nextDesignSystem ? path.join(ctx.runtimeDir, 'index.html') : 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 /**\n * In middleware mode Strapi forwards the browser Host from reverse proxies (nginx, Traefik).\n * Vite 5+ blocks unknown hosts unless explicitly allowed (#23491).\n */\n allowedHosts: true,\n middlewareMode: true,\n open: ctx.options.open,\n hmr: {\n overlay: false,\n /**\n * Use Strapi's http.Server so HMR websockets reuse the app's listen port. A separate listener\n * plus clientPort pushes browsers toward host:5173-style URLs that fail behind proxies that\n * only expose the Strapi server port (#23491, #23008).\n */\n server: ctx.strapi.server.httpServer,\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","pluginOptimizeDepsExclude","collectAdminOptimizeDepsExclude","cwd","plugins","optimizeDepsExclude","react","tailwindPlugins","nextDesignSystem","root","base","basePath","publicDir","build","emptyOutDir","outDir","distDir","cacheDir","configFile","define","process","JSON","stringify","env","envPrefix","optimizeDeps","length","exclude","include","getResolvableSingletonModules","resolve","dedupe","ADMIN_VITE_DEDUPE_MODULES","alias","buildAdminViteResolveAliases","buildFilesPlugin","resolveProductionConfig","options","minify","sourcemap","baseConfig","logLevel","mode","assetsDir","rollupOptions","input","path","join","runtimeDir","entry","resolveDevelopmentConfig","monorepo","loadStrapiMonorepo","getMonorepoAliases","server","cors","allowedHosts","middlewareMode","open","hmr","overlay","httpServer","appType","USER_CONFIGS","mergeConfigWithUserConfig","config","userConfig","getUserConfig"],"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,q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,OAAO;AACL,QAAA,GAAGiD,UAAU;QACbE,IAAAA,EAAM,aAAA;QACNZ,OAAAA,EAAS;AACP,YAAA,GAAGU,WAAWV,OAAO;YACrBG,KAAAA,EAAO;gBACL,GAAGO,UAAAA,CAAWV,OAAO,EAAEG,KAAK;AAC5B,gBAAA,GAAGoB,kBAAAA,CAAmB;AAAEF,oBAAAA;iBAAS;AACnC;AACF,SAAA;QACAG,MAAAA,EAAQ;YACNC,IAAAA,EAAM,KAAA;AACN;;;AAGC,UACDC,YAAAA,EAAc,IAAA;YACdC,cAAAA,EAAgB,IAAA;YAChBC,IAAAA,EAAMnE,GAAAA,CAAI8C,OAAO,CAACqB,IAAI;YACtBC,GAAAA,EAAK;gBACHC,OAAAA,EAAS,KAAA;AACT;;;;AAIC,YACDN,QAAQ/D,GAAAA,CAAIK,MAAM,CAAC0D,MAAM,CAACO;AAC5B;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,EAAsB1E,GAAAA,GAAAA;IAC7D,MAAM2E,UAAAA,GAAa,MAAMC,aAAAA,CAA8BJ,YAAAA,EAAcxE,GAAAA,CAAAA;AAErE,IAAA,IAAI2E,UAAAA,EAAY;AACd,QAAA,OAAOA,UAAAA,CAAWD,MAAAA,CAAAA;AACpB,IAAA;IAEA,OAAOA,MAAAA;AACT;;;;"}
|
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var path = require('node:path');
|
|
3
4
|
var staticFiles = require('../staticFiles.js');
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
9
|
+
|
|
10
|
+
const htmlEntryPlugin = (ctx)=>{
|
|
11
|
+
// Vite keys the html asset by its path from the root, so move it to the top level
|
|
12
|
+
const htmlKey = path__default.default.relative(ctx.cwd, path__default.default.join(ctx.runtimeDir, 'index.html')).split(path__default.default.sep).join('/');
|
|
13
|
+
return {
|
|
14
|
+
name: 'strapi/server/build-files',
|
|
15
|
+
apply: 'build',
|
|
16
|
+
// Run after Vite's build:html plugin, which is what emits the html asset
|
|
17
|
+
enforce: 'post',
|
|
18
|
+
async generateBundle (_options, outputBundle) {
|
|
19
|
+
const asset = outputBundle[htmlKey];
|
|
20
|
+
if (!asset) {
|
|
21
|
+
throw new Error(`Failed to find the html asset in bundle (${htmlKey}). Vite must build that file; a custom src/admin/vite.config must not replace build.rollupOptions.input`);
|
|
22
|
+
}
|
|
23
|
+
asset.fileName = 'index.html';
|
|
24
|
+
outputBundle['index.html'] = asset;
|
|
25
|
+
delete outputBundle[htmlKey];
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
// Flag-off build, identical to the build before the flag. Delete it when the flag goes
|
|
30
|
+
const legacyBuildFilesPlugin = (ctx)=>{
|
|
6
31
|
const CHUNK_ID = '.strapi/client/app.js';
|
|
7
32
|
return {
|
|
8
33
|
name: 'strapi/server/build-files',
|
|
@@ -41,6 +66,7 @@ const buildFilesPlugin = (ctx)=>{
|
|
|
41
66
|
}
|
|
42
67
|
};
|
|
43
68
|
};
|
|
69
|
+
const buildFilesPlugin = (ctx)=>ctx.nextDesignSystem ? htmlEntryPlugin(ctx) : legacyBuildFilesPlugin(ctx);
|
|
44
70
|
|
|
45
71
|
exports.buildFilesPlugin = buildFilesPlugin;
|
|
46
72
|
//# sourceMappingURL=plugins.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sources":["../../../../src/node/vite/plugins.ts"],"sourcesContent":["import type { Plugin } from 'vite';\n\nimport { getDocumentHTML } from '../staticFiles';\nimport type { BuildContext } from '../create-build-context';\n\nconst
|
|
1
|
+
{"version":3,"file":"plugins.js","sources":["../../../../src/node/vite/plugins.ts"],"sourcesContent":["import path from 'node:path';\n\nimport type { Plugin } from 'vite';\n\nimport { getDocumentHTML } from '../staticFiles';\nimport type { BuildContext } from '../create-build-context';\n\ntype BuildFilesContext = Pick<\n BuildContext,\n 'cwd' | 'runtimeDir' | 'basePath' | 'logger' | 'nextDesignSystem'\n>;\n\nconst htmlEntryPlugin = (ctx: BuildFilesContext): Plugin => {\n // Vite keys the html asset by its path from the root, so move it to the top level\n const htmlKey = path\n .relative(ctx.cwd, path.join(ctx.runtimeDir, 'index.html'))\n .split(path.sep)\n .join('/');\n\n return {\n name: 'strapi/server/build-files',\n apply: 'build',\n // Run after Vite's build:html plugin, which is what emits the html asset\n enforce: 'post',\n async generateBundle(_options, outputBundle) {\n const asset = outputBundle[htmlKey];\n\n if (!asset) {\n throw new Error(\n `Failed to find the html asset in bundle (${htmlKey}). Vite must build that file; a custom src/admin/vite.config must not replace build.rollupOptions.input`\n );\n }\n\n asset.fileName = 'index.html';\n outputBundle['index.html'] = asset;\n delete outputBundle[htmlKey];\n },\n };\n};\n\n// Flag-off build, identical to the build before the flag. Delete it when the flag goes\nconst legacyBuildFilesPlugin = (ctx: BuildFilesContext): Plugin => {\n const CHUNK_ID = '.strapi/client/app.js';\n\n return {\n name: 'strapi/server/build-files',\n apply: 'build',\n buildStart() {\n this.emitFile({\n type: 'chunk',\n id: CHUNK_ID,\n name: 'strapi',\n });\n },\n async generateBundle(_options, outputBundle) {\n const bundle = outputBundle;\n const entryFile = Object.values(bundle).find(\n (file) =>\n file.type === 'chunk' && file.name === 'strapi' && file.facadeModuleId?.endsWith(CHUNK_ID)\n );\n\n if (!entryFile) {\n throw new Error(`Failed to find entry file in bundle (${CHUNK_ID})`);\n }\n\n if (entryFile.type !== 'chunk') {\n throw new Error('Entry file is not a chunk');\n }\n\n const entryFileName = entryFile.fileName;\n const entryPath = [ctx.basePath.replace(/\\/+$/, ''), entryFileName].join('/');\n\n this.emitFile({\n type: 'asset',\n fileName: 'index.html',\n source: getDocumentHTML({\n logger: ctx.logger,\n props: {\n entryPath,\n },\n }),\n });\n },\n };\n};\n\nconst buildFilesPlugin = (ctx: BuildFilesContext): Plugin =>\n ctx.nextDesignSystem ? htmlEntryPlugin(ctx) : legacyBuildFilesPlugin(ctx);\n\nexport { buildFilesPlugin };\n"],"names":["htmlEntryPlugin","ctx","htmlKey","path","relative","cwd","join","runtimeDir","split","sep","name","apply","enforce","generateBundle","_options","outputBundle","asset","Error","fileName","legacyBuildFilesPlugin","CHUNK_ID","buildStart","emitFile","type","id","bundle","entryFile","Object","values","find","file","facadeModuleId","endsWith","entryFileName","entryPath","basePath","replace","source","getDocumentHTML","logger","props","buildFilesPlugin","nextDesignSystem"],"mappings":";;;;;;;;;AAYA,MAAMA,kBAAkB,CAACC,GAAAA,GAAAA;;IAEvB,MAAMC,OAAAA,GAAUC,sBACbC,QAAQ,CAACH,IAAII,GAAG,EAAEF,sBAAKG,IAAI,CAACL,IAAIM,UAAU,EAAE,eAC5CC,KAAK,CAACL,sBAAKM,GAAG,CAAA,CACdH,IAAI,CAAC,GAAA,CAAA;IAER,OAAO;QACLI,IAAAA,EAAM,2BAAA;QACNC,KAAAA,EAAO,OAAA;;QAEPC,OAAAA,EAAS,MAAA;QACT,MAAMC,cAAAA,CAAAA,CAAeC,QAAQ,EAAEC,YAAY,EAAA;YACzC,MAAMC,KAAAA,GAAQD,YAAY,CAACb,OAAAA,CAAQ;AAEnC,YAAA,IAAI,CAACc,KAAAA,EAAO;AACV,gBAAA,MAAM,IAAIC,KAAAA,CACR,CAAC,yCAAyC,EAAEf,OAAAA,CAAQ,uGAAuG,CAAC,CAAA;AAEhK,YAAA;AAEAc,YAAAA,KAAAA,CAAME,QAAQ,GAAG,YAAA;YACjBH,YAAY,CAAC,aAAa,GAAGC,KAAAA;YAC7B,OAAOD,YAAY,CAACb,OAAAA,CAAQ;AAC9B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,EAAU,YAAA;AACVmB,gBAAAA,MAAAA,EAAQC,2BAAAA,CAAgB;AACtBC,oBAAAA,MAAAA,EAAQtC,IAAIsC,MAAM;oBAClBC,KAAAA,EAAO;AACLN,wBAAAA;AACF;AACF,iBAAA;AACF,aAAA,CAAA;AACF,QAAA;AACF,KAAA;AACF,CAAA;AAEA,MAAMO,gBAAAA,GAAmB,CAACxC,GAAAA,GACxBA,GAAAA,CAAIyC,gBAAgB,GAAG1C,eAAAA,CAAgBC,OAAOkB,sBAAAA,CAAuBlB,GAAAA;;;;"}
|
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
1
2
|
import { getDocumentHTML } from '../staticFiles.mjs';
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
+
const htmlEntryPlugin = (ctx)=>{
|
|
5
|
+
// Vite keys the html asset by its path from the root, so move it to the top level
|
|
6
|
+
const htmlKey = path.relative(ctx.cwd, path.join(ctx.runtimeDir, 'index.html')).split(path.sep).join('/');
|
|
7
|
+
return {
|
|
8
|
+
name: 'strapi/server/build-files',
|
|
9
|
+
apply: 'build',
|
|
10
|
+
// Run after Vite's build:html plugin, which is what emits the html asset
|
|
11
|
+
enforce: 'post',
|
|
12
|
+
async generateBundle (_options, outputBundle) {
|
|
13
|
+
const asset = outputBundle[htmlKey];
|
|
14
|
+
if (!asset) {
|
|
15
|
+
throw new Error(`Failed to find the html asset in bundle (${htmlKey}). Vite must build that file; a custom src/admin/vite.config must not replace build.rollupOptions.input`);
|
|
16
|
+
}
|
|
17
|
+
asset.fileName = 'index.html';
|
|
18
|
+
outputBundle['index.html'] = asset;
|
|
19
|
+
delete outputBundle[htmlKey];
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
// Flag-off build, identical to the build before the flag. Delete it when the flag goes
|
|
24
|
+
const legacyBuildFilesPlugin = (ctx)=>{
|
|
4
25
|
const CHUNK_ID = '.strapi/client/app.js';
|
|
5
26
|
return {
|
|
6
27
|
name: 'strapi/server/build-files',
|
|
@@ -39,6 +60,7 @@ const buildFilesPlugin = (ctx)=>{
|
|
|
39
60
|
}
|
|
40
61
|
};
|
|
41
62
|
};
|
|
63
|
+
const buildFilesPlugin = (ctx)=>ctx.nextDesignSystem ? htmlEntryPlugin(ctx) : legacyBuildFilesPlugin(ctx);
|
|
42
64
|
|
|
43
65
|
export { buildFilesPlugin };
|
|
44
66
|
//# sourceMappingURL=plugins.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.mjs","sources":["../../../../src/node/vite/plugins.ts"],"sourcesContent":["import type { Plugin } from 'vite';\n\nimport { getDocumentHTML } from '../staticFiles';\nimport type { BuildContext } from '../create-build-context';\n\nconst
|
|
1
|
+
{"version":3,"file":"plugins.mjs","sources":["../../../../src/node/vite/plugins.ts"],"sourcesContent":["import path from 'node:path';\n\nimport type { Plugin } from 'vite';\n\nimport { getDocumentHTML } from '../staticFiles';\nimport type { BuildContext } from '../create-build-context';\n\ntype BuildFilesContext = Pick<\n BuildContext,\n 'cwd' | 'runtimeDir' | 'basePath' | 'logger' | 'nextDesignSystem'\n>;\n\nconst htmlEntryPlugin = (ctx: BuildFilesContext): Plugin => {\n // Vite keys the html asset by its path from the root, so move it to the top level\n const htmlKey = path\n .relative(ctx.cwd, path.join(ctx.runtimeDir, 'index.html'))\n .split(path.sep)\n .join('/');\n\n return {\n name: 'strapi/server/build-files',\n apply: 'build',\n // Run after Vite's build:html plugin, which is what emits the html asset\n enforce: 'post',\n async generateBundle(_options, outputBundle) {\n const asset = outputBundle[htmlKey];\n\n if (!asset) {\n throw new Error(\n `Failed to find the html asset in bundle (${htmlKey}). Vite must build that file; a custom src/admin/vite.config must not replace build.rollupOptions.input`\n );\n }\n\n asset.fileName = 'index.html';\n outputBundle['index.html'] = asset;\n delete outputBundle[htmlKey];\n },\n };\n};\n\n// Flag-off build, identical to the build before the flag. Delete it when the flag goes\nconst legacyBuildFilesPlugin = (ctx: BuildFilesContext): Plugin => {\n const CHUNK_ID = '.strapi/client/app.js';\n\n return {\n name: 'strapi/server/build-files',\n apply: 'build',\n buildStart() {\n this.emitFile({\n type: 'chunk',\n id: CHUNK_ID,\n name: 'strapi',\n });\n },\n async generateBundle(_options, outputBundle) {\n const bundle = outputBundle;\n const entryFile = Object.values(bundle).find(\n (file) =>\n file.type === 'chunk' && file.name === 'strapi' && file.facadeModuleId?.endsWith(CHUNK_ID)\n );\n\n if (!entryFile) {\n throw new Error(`Failed to find entry file in bundle (${CHUNK_ID})`);\n }\n\n if (entryFile.type !== 'chunk') {\n throw new Error('Entry file is not a chunk');\n }\n\n const entryFileName = entryFile.fileName;\n const entryPath = [ctx.basePath.replace(/\\/+$/, ''), entryFileName].join('/');\n\n this.emitFile({\n type: 'asset',\n fileName: 'index.html',\n source: getDocumentHTML({\n logger: ctx.logger,\n props: {\n entryPath,\n },\n }),\n });\n },\n };\n};\n\nconst buildFilesPlugin = (ctx: BuildFilesContext): Plugin =>\n ctx.nextDesignSystem ? htmlEntryPlugin(ctx) : legacyBuildFilesPlugin(ctx);\n\nexport { buildFilesPlugin };\n"],"names":["htmlEntryPlugin","ctx","htmlKey","path","relative","cwd","join","runtimeDir","split","sep","name","apply","enforce","generateBundle","_options","outputBundle","asset","Error","fileName","legacyBuildFilesPlugin","CHUNK_ID","buildStart","emitFile","type","id","bundle","entryFile","Object","values","find","file","facadeModuleId","endsWith","entryFileName","entryPath","basePath","replace","source","getDocumentHTML","logger","props","buildFilesPlugin","nextDesignSystem"],"mappings":";;;AAYA,MAAMA,kBAAkB,CAACC,GAAAA,GAAAA;;IAEvB,MAAMC,OAAAA,GAAUC,KACbC,QAAQ,CAACH,IAAII,GAAG,EAAEF,KAAKG,IAAI,CAACL,IAAIM,UAAU,EAAE,eAC5CC,KAAK,CAACL,KAAKM,GAAG,CAAA,CACdH,IAAI,CAAC,GAAA,CAAA;IAER,OAAO;QACLI,IAAAA,EAAM,2BAAA;QACNC,KAAAA,EAAO,OA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;AACrE,YAAA;YAEA,IAAIM,SAAAA,CAAUH,IAAI,KAAK,OAAA,EAAS;AAC9B,gBAAA,MAAM,IAAIN,KAAAA,CAAM,2BAAA,CAAA;AAClB,YAAA;YAEA,MAAMgB,aAAAA,GAAgBP,UAAUR,QAAQ;AACxC,YAAA,MAAMgB,SAAAA,GAAY;AAACjC,gBAAAA,GAAAA,CAAIkC,QAAQ,CAACC,OAAO,CAAC,MAAA,EAAQ,EAAA,CAAA;AAAKH,gBAAAA;AAAc,aAAA,CAAC3B,IAAI,CAAC,GAAA,CAAA;YAEzE,IAAI,CAACgB,QAAQ,CAAC;gBACZC,IAAAA,EAAM,OAAA;gBACNL,QAAAA,EAAU,YAAA;AACVmB,gBAAAA,MAAAA,EAAQC,eAAAA,CAAgB;AACtBC,oBAAAA,MAAAA,EAAQtC,IAAIsC,MAAM;oBAClBC,KAAAA,EAAO;AACLN,wBAAAA;AACF;AACF,iBAAA;AACF,aAAA,CAAA;AACF,QAAA;AACF,KAAA;AACF,CAAA;AAEA,MAAMO,gBAAAA,GAAmB,CAACxC,GAAAA,GACxBA,GAAAA,CAAIyC,gBAAgB,GAAG1C,eAAAA,CAAgBC,OAAOkB,sBAAAA,CAAuBlB,GAAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/strapi",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.56.0",
|
|
4
4
|
"description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"require": "./dist/admin-test.js",
|
|
85
85
|
"default": "./dist/admin-test.js"
|
|
86
86
|
},
|
|
87
|
+
"./admin/styles.css": "./admin-styles.css",
|
|
87
88
|
"./package.json": "./package.json"
|
|
88
89
|
},
|
|
89
90
|
"main": "./dist/index.js",
|
|
@@ -92,6 +93,7 @@
|
|
|
92
93
|
"types": "./dist/index.d.ts",
|
|
93
94
|
"bin": "./bin/strapi.js",
|
|
94
95
|
"files": [
|
|
96
|
+
"admin-styles.css",
|
|
95
97
|
"dist/",
|
|
96
98
|
"bin/",
|
|
97
99
|
"resources/",
|
|
@@ -110,28 +112,29 @@
|
|
|
110
112
|
},
|
|
111
113
|
"dependencies": {
|
|
112
114
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.17",
|
|
113
|
-
"@strapi/admin": "5.
|
|
114
|
-
"@strapi/cloud-cli": "5.
|
|
115
|
-
"@strapi/content-manager": "5.
|
|
116
|
-
"@strapi/content-releases": "5.
|
|
117
|
-
"@strapi/content-type-builder": "5.
|
|
118
|
-
"@strapi/core": "5.
|
|
119
|
-
"@strapi/data-transfer": "5.
|
|
120
|
-
"@strapi/database": "5.
|
|
121
|
-
"@strapi/email": "5.
|
|
122
|
-
"@strapi/generators": "5.
|
|
123
|
-
"@strapi/i18n": "5.
|
|
124
|
-
"@strapi/logger": "5.
|
|
125
|
-
"@strapi/openapi": "5.
|
|
126
|
-
"@strapi/permissions": "5.
|
|
127
|
-
"@strapi/review-workflows": "5.
|
|
128
|
-
"@strapi/types": "5.
|
|
129
|
-
"@strapi/typescript-utils": "5.
|
|
130
|
-
"@strapi/upload": "5.
|
|
131
|
-
"@strapi/utils": "5.
|
|
115
|
+
"@strapi/admin": "5.56.0",
|
|
116
|
+
"@strapi/cloud-cli": "5.56.0",
|
|
117
|
+
"@strapi/content-manager": "5.56.0",
|
|
118
|
+
"@strapi/content-releases": "5.56.0",
|
|
119
|
+
"@strapi/content-type-builder": "5.56.0",
|
|
120
|
+
"@strapi/core": "5.56.0",
|
|
121
|
+
"@strapi/data-transfer": "5.56.0",
|
|
122
|
+
"@strapi/database": "5.56.0",
|
|
123
|
+
"@strapi/email": "5.56.0",
|
|
124
|
+
"@strapi/generators": "5.56.0",
|
|
125
|
+
"@strapi/i18n": "5.56.0",
|
|
126
|
+
"@strapi/logger": "5.56.0",
|
|
127
|
+
"@strapi/openapi": "5.56.0",
|
|
128
|
+
"@strapi/permissions": "5.56.0",
|
|
129
|
+
"@strapi/review-workflows": "5.56.0",
|
|
130
|
+
"@strapi/types": "5.56.0",
|
|
131
|
+
"@strapi/typescript-utils": "5.56.0",
|
|
132
|
+
"@strapi/upload": "5.56.0",
|
|
133
|
+
"@strapi/utils": "5.56.0",
|
|
134
|
+
"@tailwindcss/vite": "4.3.3",
|
|
132
135
|
"@vitejs/plugin-react-swc": "3.11.0",
|
|
133
136
|
"boxen": "5.1.2",
|
|
134
|
-
"browserslist": "^4.
|
|
137
|
+
"browserslist": "^4.28.8",
|
|
135
138
|
"browserslist-to-esbuild": "2.1.1",
|
|
136
139
|
"chalk": "4.1.2",
|
|
137
140
|
"chokidar": "3.6.0",
|
|
@@ -157,8 +160,10 @@
|
|
|
157
160
|
"react-refresh": "0.14.0",
|
|
158
161
|
"read-pkg-up": "7.0.1",
|
|
159
162
|
"resolve-from": "5.0.0",
|
|
163
|
+
"resolve.exports": "2.0.2",
|
|
160
164
|
"semver": "7.7.4",
|
|
161
165
|
"style-loader": "3.3.4",
|
|
166
|
+
"tailwindcss": "4.3.3",
|
|
162
167
|
"typescript": "5.9.3",
|
|
163
168
|
"vite": "5.4.21",
|
|
164
169
|
"webpack": "5.109.2",
|
|
@@ -175,16 +180,16 @@
|
|
|
175
180
|
"@types/node": "20.19.41",
|
|
176
181
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
177
182
|
"@types/webpack-hot-middleware": "2.25.12",
|
|
178
|
-
"eslint-config-custom": "5.
|
|
183
|
+
"eslint-config-custom": "5.56.0",
|
|
179
184
|
"jest": "29.6.0",
|
|
180
185
|
"react": "18.3.1",
|
|
181
186
|
"react-dom": "18.3.1",
|
|
182
|
-
"tsconfig": "5.
|
|
187
|
+
"tsconfig": "5.56.0",
|
|
183
188
|
"yalc": "1.0.0-pre.53"
|
|
184
189
|
},
|
|
185
190
|
"peerDependencies": {
|
|
186
|
-
"react": "^
|
|
187
|
-
"react-dom": "^
|
|
191
|
+
"react": "^18.0.0",
|
|
192
|
+
"react-dom": "^18.0.0",
|
|
188
193
|
"react-router-dom": "^6.30.3",
|
|
189
194
|
"styled-components": "^6.0.0"
|
|
190
195
|
},
|