@strapi/strapi 5.61.1 → 5.62.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/dist/cli/commands/enterprise/index.d.ts.map +1 -1
- package/dist/cli/commands/enterprise/install/action.d.ts +5 -2
- package/dist/cli/commands/enterprise/install/action.d.ts.map +1 -1
- package/dist/cli/commands/enterprise/install/checklist-prompt.d.ts +6 -1
- package/dist/cli/commands/enterprise/install/checklist-prompt.d.ts.map +1 -1
- package/dist/cli/commands/enterprise/install/discovery.d.ts +10 -2
- package/dist/cli/commands/enterprise/install/discovery.d.ts.map +1 -1
- package/dist/cli/commands/enterprise/install/install-packages.d.ts +3 -1
- package/dist/cli/commands/enterprise/install/install-packages.d.ts.map +1 -1
- package/dist/cli/commands/enterprise/install/package-name.d.ts +2 -0
- package/dist/cli/commands/enterprise/install/package-name.d.ts.map +1 -0
- package/dist/cli/commands/enterprise/install/printable-text.d.ts +2 -0
- package/dist/cli/commands/enterprise/install/printable-text.d.ts.map +1 -0
- package/dist/cli/commands/enterprise/install/registry-access.d.ts +9 -4
- package/dist/cli/commands/enterprise/install/registry-access.d.ts.map +1 -1
- package/dist/cli/commands/enterprise/install/registry-override.d.ts +17 -0
- package/dist/cli/commands/enterprise/install/registry-override.d.ts.map +1 -0
- package/dist/cli/commands/enterprise/install/registry-url.d.ts +18 -0
- package/dist/cli/commands/enterprise/install/registry-url.d.ts.map +1 -0
- package/dist/cli/commands/enterprise/install/registry.d.ts +24 -13
- package/dist/cli/commands/enterprise/install/registry.d.ts.map +1 -1
- package/dist/cli/commands/enterprise/install/selection.d.ts +15 -4
- package/dist/cli/commands/enterprise/install/selection.d.ts.map +1 -1
- package/dist/cli/commands/enterprise/install/versions.d.ts.map +1 -1
- package/dist/node/core/dependencies.d.ts +7 -1
- package/dist/node/core/dependencies.d.ts.map +1 -1
- package/dist/node/core/ensure-admin-dependencies.d.ts.map +1 -1
- package/dist/node/core/scan-roots.d.ts +2 -2
- package/dist/node/create-build-context.d.ts +1 -6
- 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.map +1 -1
- package/dist/node/vite/config.d.ts.map +1 -1
- package/dist/node/vite/plugins.d.ts +1 -1
- package/dist/node/vite/plugins.d.ts.map +1 -1
- package/dist/node/webpack/config.d.ts.map +1 -1
- package/dist/package.json.js +1 -1
- package/dist/package.json.mjs +1 -1
- package/dist/src/cli/commands/enterprise/index.js +1 -1
- package/dist/src/cli/commands/enterprise/index.js.map +1 -1
- package/dist/src/cli/commands/enterprise/index.mjs +2 -2
- package/dist/src/cli/commands/enterprise/index.mjs.map +1 -1
- package/dist/src/cli/commands/enterprise/install/action.js +81 -33
- package/dist/src/cli/commands/enterprise/install/action.js.map +1 -1
- package/dist/src/cli/commands/enterprise/install/action.mjs +79 -31
- package/dist/src/cli/commands/enterprise/install/action.mjs.map +1 -1
- package/dist/src/cli/commands/enterprise/install/checklist-prompt.js +18 -1
- package/dist/src/cli/commands/enterprise/install/checklist-prompt.js.map +1 -1
- package/dist/src/cli/commands/enterprise/install/checklist-prompt.mjs +18 -1
- package/dist/src/cli/commands/enterprise/install/checklist-prompt.mjs.map +1 -1
- package/dist/src/cli/commands/enterprise/install/discovery.js +63 -27
- package/dist/src/cli/commands/enterprise/install/discovery.js.map +1 -1
- package/dist/src/cli/commands/enterprise/install/discovery.mjs +66 -30
- package/dist/src/cli/commands/enterprise/install/discovery.mjs.map +1 -1
- package/dist/src/cli/commands/enterprise/install/install-packages.js +3 -2
- package/dist/src/cli/commands/enterprise/install/install-packages.js.map +1 -1
- package/dist/src/cli/commands/enterprise/install/install-packages.mjs +3 -2
- package/dist/src/cli/commands/enterprise/install/install-packages.mjs.map +1 -1
- package/dist/src/cli/commands/enterprise/install/package-name.js +10 -0
- package/dist/src/cli/commands/enterprise/install/package-name.js.map +1 -0
- package/dist/src/cli/commands/enterprise/install/package-name.mjs +8 -0
- package/dist/src/cli/commands/enterprise/install/package-name.mjs.map +1 -0
- package/dist/src/cli/commands/enterprise/install/printable-text.js +16 -0
- package/dist/src/cli/commands/enterprise/install/printable-text.js.map +1 -0
- package/dist/src/cli/commands/enterprise/install/printable-text.mjs +14 -0
- package/dist/src/cli/commands/enterprise/install/printable-text.mjs.map +1 -0
- package/dist/src/cli/commands/enterprise/install/registry-access.js +5 -2
- package/dist/src/cli/commands/enterprise/install/registry-access.js.map +1 -1
- package/dist/src/cli/commands/enterprise/install/registry-access.mjs +6 -3
- package/dist/src/cli/commands/enterprise/install/registry-access.mjs.map +1 -1
- package/dist/src/cli/commands/enterprise/install/registry-override.js +95 -0
- package/dist/src/cli/commands/enterprise/install/registry-override.js.map +1 -0
- package/dist/src/cli/commands/enterprise/install/registry-override.mjs +87 -0
- package/dist/src/cli/commands/enterprise/install/registry-override.mjs.map +1 -0
- package/dist/src/cli/commands/enterprise/install/registry-url.js +55 -0
- package/dist/src/cli/commands/enterprise/install/registry-url.js.map +1 -0
- package/dist/src/cli/commands/enterprise/install/registry-url.mjs +53 -0
- package/dist/src/cli/commands/enterprise/install/registry-url.mjs.map +1 -0
- package/dist/src/cli/commands/enterprise/install/registry.js +73 -47
- package/dist/src/cli/commands/enterprise/install/registry.js.map +1 -1
- package/dist/src/cli/commands/enterprise/install/registry.mjs +74 -48
- package/dist/src/cli/commands/enterprise/install/registry.mjs.map +1 -1
- package/dist/src/cli/commands/enterprise/install/selection.js +39 -12
- package/dist/src/cli/commands/enterprise/install/selection.js.map +1 -1
- package/dist/src/cli/commands/enterprise/install/selection.mjs +38 -13
- package/dist/src/cli/commands/enterprise/install/selection.mjs.map +1 -1
- package/dist/src/cli/commands/enterprise/install/versions.js +7 -5
- package/dist/src/cli/commands/enterprise/install/versions.js.map +1 -1
- package/dist/src/cli/commands/enterprise/install/versions.mjs +7 -5
- package/dist/src/cli/commands/enterprise/install/versions.mjs.map +1 -1
- package/dist/src/node/core/admin-vite-aliases.mjs +1 -1
- package/dist/src/node/core/dependencies.js +36 -0
- package/dist/src/node/core/dependencies.js.map +1 -1
- package/dist/src/node/core/dependencies.mjs +36 -1
- package/dist/src/node/core/dependencies.mjs.map +1 -1
- package/dist/src/node/core/ensure-admin-dependencies.js +2 -0
- package/dist/src/node/core/ensure-admin-dependencies.js.map +1 -1
- package/dist/src/node/core/ensure-admin-dependencies.mjs +3 -1
- package/dist/src/node/core/ensure-admin-dependencies.mjs.map +1 -1
- package/dist/src/node/core/scan-roots.js +3 -3
- package/dist/src/node/core/scan-roots.js.map +1 -1
- package/dist/src/node/core/scan-roots.mjs +3 -3
- package/dist/src/node/core/scan-roots.mjs.map +1 -1
- package/dist/src/node/create-build-context.js +3 -33
- package/dist/src/node/create-build-context.js.map +1 -1
- package/dist/src/node/create-build-context.mjs +3 -33
- package/dist/src/node/create-build-context.mjs.map +1 -1
- package/dist/src/node/develop.js +44 -6
- package/dist/src/node/develop.js.map +1 -1
- package/dist/src/node/develop.mjs +44 -6
- package/dist/src/node/develop.mjs.map +1 -1
- package/dist/src/node/staticFiles.js +17 -6
- package/dist/src/node/staticFiles.js.map +1 -1
- package/dist/src/node/staticFiles.mjs +17 -6
- package/dist/src/node/staticFiles.mjs.map +1 -1
- package/dist/src/node/vite/config.js +5 -7
- package/dist/src/node/vite/config.js.map +1 -1
- package/dist/src/node/vite/config.mjs +5 -7
- package/dist/src/node/vite/config.mjs.map +1 -1
- package/dist/src/node/vite/plugins.js +35 -45
- package/dist/src/node/vite/plugins.js.map +1 -1
- package/dist/src/node/vite/plugins.mjs +35 -45
- package/dist/src/node/vite/plugins.mjs.map +1 -1
- package/dist/src/node/webpack/config.js +39 -3
- package/dist/src/node/webpack/config.js.map +1 -1
- package/dist/src/node/webpack/config.mjs +38 -4
- package/dist/src/node/webpack/config.mjs.map +1 -1
- package/package.json +25 -24
- package/admin-styles.css +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticFiles.js","sources":["../../../src/node/staticFiles.ts"],"sourcesContent":["import fs from 'node:fs/promises';\nimport path from 'node:path';\nimport outdent from 'outdent';\nimport { createElement } from 'react';\nimport { renderToStaticMarkup } from 'react-dom/server';\nimport { DefaultDocument } from '@strapi/admin/_internal';\n\nimport { toGlobPath } from './core/scan-roots';\n\nimport type { BuildContext } from './create-build-context';\n\n/**\n * Quote an `@source` path with a quote character the path does not hold. Tailwind decodes no\n * backslash escape, so an escape breaks both the path and any glob metacharacter such as `(x86)`\n */\nconst toCssString = (value: string): string => {\n if (!value.includes('\"')) {\n return `\"${value}\"`;\n }\n\n if (!value.includes(\"'\")) {\n return `'${value}'`;\n }\n\n throw new Error(\n `Strapi cannot write \"${value}\" into the admin stylesheet, because the path holds both quote characters. Move the directory.`\n );\n};\n\n// Files that hold class names but reach no page. Strapi joins each pattern to a scan root\nconst EXCLUDED_SOURCES = [\n '**/node_modules/**',\n '**/__tests__/**',\n '**/*.test.*',\n '**/*.spec.*',\n '**/*.stories.*',\n '**/*.d.ts',\n '**/*.map',\n];\n\nconst getSourceLines = (roots: string[]): string =>\n roots\n .map(toGlobPath)\n .flatMap((root) => [\n `@source ${toCssString(root)};`,\n ...EXCLUDED_SOURCES.map((pattern) => `@source not ${toCssString(`${root}/${pattern}`)};`),\n ])\n .join('\\n');\n\nconst getStylesheet = (ctx: BuildContext): string => outdent`\n /**\n * This file was automatically generated by Strapi.\n * Any modifications made will be discarded.\n */\n @import '@strapi/strapi/admin/styles.css';\n\n ${getSourceLines(ctx.scanRoots)}\n `;\n\nconst getEntryModule = (ctx: BuildContext): string => {\n const pluginsObject = ctx.plugins\n .map(({ name, importName }) => `'${name}': ${importName}`)\n .join(',\\n');\n\n const pluginsImport = ctx.plugins\n .map(({ importName, modulePath }) => `import ${importName} from '${modulePath}';`)\n .join('\\n');\n\n return outdent`\n /**\n * This file was automatically generated by Strapi.\n * Any modifications made will be discarded.\n */\n ${ctx.nextDesignSystem ? \"import './styles.css';\" : ''}\n ${pluginsImport}\n import { renderAdmin } from \"@strapi/strapi/admin\"\n\n ${\n ctx.customisations?.modulePath\n ? `import customisations from '${ctx.customisations.modulePath}'`\n : ''\n }\n\n renderAdmin(\n document.getElementById(\"strapi\"),\n {\n ${ctx.customisations?.modulePath ? 'customisations,' : ''}\n ${ctx.features ? `features: ${JSON.stringify(ctx.features)},` : ''}\n plugins: {\n ${pluginsObject}\n }\n })\n `;\n};\n\ninterface GetDocumentHTMLArgs extends Pick<BuildContext, 'logger'> {\n props?: {\n entryPath?: string;\n };\n}\n\n/**\n * TODO: Here in the future we could add the ability\n * to load a user's Document component?\n */\nconst getDocumentHTML = ({ logger, props = {} }: GetDocumentHTMLArgs) => {\n const result = renderToStaticMarkup(createElement(DefaultDocument, props));\n logger.debug('Rendered the HTML');\n\n return outdent`<!DOCTYPE html>${result}`;\n};\n\nconst AUTO_GENERATED_WARNING = `\nThis file was automatically generated by Strapi.\nAny modifications made will be discarded.\n`.trim();\n\n/**\n * Because we now auto-generate the index.html file,\n * we should be clear that people _should not_ modify it.\n *\n * @internal\n */\nconst decorateHTMLWithAutoGeneratedWarning = (htmlTemplate: string): string =>\n htmlTemplate.replace(/<head/, `\\n<!--\\n${AUTO_GENERATED_WARNING}\\n-->\\n<head`);\n\nconst writeStaticClientFiles = async (ctx: BuildContext) => {\n const prettier = await import('prettier'); // ESM-only\n\n /**\n * For everything to work effectively we create a client folder in `.strapi` at the cwd level.\n * We then use the function we need to \"createAdmin\" as well as generate the Document index.html as well.\n *\n * All this links together an imaginary \"src/index\" that then allows vite to correctly build the admin panel.\n */\n\n await fs.mkdir(ctx.runtimeDir, { recursive: true });\n ctx.logger.debug('Created the runtime directory');\n\n const indexHtml = decorateHTMLWithAutoGeneratedWarning(\n await getDocumentHTML({\n logger: ctx.logger,\n props:\n ctx.bundler === 'vite'\n ? {\n entryPath: `/${ctx.entry}`,\n }\n : undefined,\n })\n );\n\n await fs.writeFile(\n path.join(ctx.runtimeDir, 'index.html'),\n await prettier.format(indexHtml, {\n parser: 'html',\n })\n );\n ctx.logger.debug('Wrote the index.html file');\n await fs.writeFile(\n path.join(ctx.runtimeDir, 'app.js'),\n await prettier.format(getEntryModule(ctx), {\n parser: 'babel',\n })\n );\n ctx.logger.debug('Wrote the app.js file');\n\n if (ctx.nextDesignSystem) {\n await fs.writeFile(path.join(ctx.runtimeDir, 'styles.css'), getStylesheet(ctx));\n ctx.logger.debug('Wrote the styles.css file');\n }\n};\n\nexport { writeStaticClientFiles, getDocumentHTML, getStylesheet, getEntryModule };\n"],"names":["toCssString","value","includes","Error","EXCLUDED_SOURCES","getSourceLines","roots","map","toGlobPath","flatMap","root","pattern","join","getStylesheet","ctx","outdent","scanRoots","getEntryModule","pluginsObject","plugins","name","importName","pluginsImport","modulePath","nextDesignSystem","customisations","features","JSON","stringify","getDocumentHTML","logger","props","result","renderToStaticMarkup","createElement","DefaultDocument","debug","AUTO_GENERATED_WARNING","trim","decorateHTMLWithAutoGeneratedWarning","htmlTemplate","replace","writeStaticClientFiles","prettier","fs","mkdir","runtimeDir","recursive","indexHtml","bundler","entryPath","entry","undefined","writeFile","path","format","parser"],"mappings":";;;;;;;;;;;;;;;;AAWA;;;IAIA,MAAMA,cAAc,CAACC,KAAAA,GAAAA;AACnB,IAAA,IAAI,CAACA,KAAAA,CAAMC,QAAQ,CAAC,GAAA,CAAA,EAAM;AACxB,QAAA,OAAO,CAAC,CAAC,EAAED,KAAAA,CAAM,CAAC,CAAC;AACrB,IAAA;AAEA,IAAA,IAAI,CAACA,KAAAA,CAAMC,QAAQ,CAAC,GAAA,CAAA,EAAM;AACxB,QAAA,OAAO,CAAC,CAAC,EAAED,KAAAA,CAAM,CAAC,CAAC;AACrB,IAAA;AAEA,IAAA,MAAM,IAAIE,KAAAA,CACR,CAAC,qBAAqB,EAAEF,KAAAA,CAAM,8FAA8F,CAAC,CAAA;AAEjI,CAAA;AAEA;AACA,MAAMG,gBAAAA,GAAmB;AACvB,IAAA,oBAAA;AACA,IAAA,iBAAA;AACA,IAAA,aAAA;AACA,IAAA,aAAA;A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ChB,MAAMV,eAAAA,CAAgB;AACpBC,QAAAA,MAAAA,EAAQhB,IAAIgB,MAAM;QAClBC,KAAAA,EACEjB,GAAAA,CAAImC,OAAO,KAAK,MAAA,GACZ;AACEC,YAAAA,SAAAA,EAAW,CAAC,CAAC,EAAEpC,GAAAA,CAAIqC,KAAK,CAAA;SAC1B,GACAC;AACR,KAAA,CAAA,CAAA;AAGF,IAAA,MAAMR,mBAAAA,CAAGS,SAAS,CAChBC,qBAAAA,CAAK1C,IAAI,CAACE,GAAAA,CAAIgC,UAAU,EAAE,YAAA,CAAA,EAC1B,MAAMH,QAAAA,CAASY,MAAM,CAACP,SAAAA,EAAW;QAC/BQ,MAAAA,EAAQ;AACV,KAAA,CAAA,CAAA;IAEF1C,GAAAA,CAAIgB,MAAM,CAACM,KAAK,CAAC,2BAAA,CAAA;AACjB,IAAA,MAAMQ,mBAAAA,CAAGS,SAAS,CAChBC,qBAAAA,CAAK1C,IAAI,CAACE,GAAAA,CAAIgC,UAAU,EAAE,WAC1B,MAAMH,QAAAA,CAASY,MAAM,CAACtC,eAAeH,GAAAA,CAAAA,EAAM;QACzC0C,MAAAA,EAAQ;AACV,KAAA,CAAA,CAAA;IAEF1C,GAAAA,CAAIgB,MAAM,CAACM,KAAK,CAAC,uBAAA,CAAA;IAEjB,IAAItB,GAAAA,CAAIU,gBAAgB,EAAE;QACxB,MAAMoB,mBAAAA,CAAGS,SAAS,CAACC,qBAAAA,CAAK1C,IAAI,CAACE,GAAAA,CAAIgC,UAAU,EAAE,YAAA,CAAA,EAAejC,aAAAA,CAAcC,GAAAA,CAAAA,CAAAA;QAC1EA,GAAAA,CAAIgB,MAAM,CAACM,KAAK,CAAC,2BAAA,CAAA;AACnB,IAAA;AACF;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"staticFiles.js","sources":["../../../src/node/staticFiles.ts"],"sourcesContent":["import fs from 'node:fs/promises';\nimport path from 'node:path';\nimport outdent from 'outdent';\nimport { createElement } from 'react';\nimport { renderToStaticMarkup } from 'react-dom/server';\nimport { DefaultDocument } from '@strapi/admin/_internal';\n\nimport { getSubpathEntries } from './core/admin-vite-aliases';\nimport { toGlobPath } from './core/scan-roots';\n\nimport type { BuildContext } from './create-build-context';\n\n/**\n * Quote an `@source` path with a quote character the path does not hold. Tailwind decodes no\n * backslash escape, so an escape breaks both the path and any glob metacharacter such as `(x86)`\n */\nconst toCssString = (value: string): string => {\n if (!value.includes('\"')) {\n return `\"${value}\"`;\n }\n\n if (!value.includes(\"'\")) {\n return `'${value}'`;\n }\n\n throw new Error(\n `Strapi cannot write \"${value}\" into the admin stylesheet, because the path holds both quote characters. Move the directory.`\n );\n};\n\n// Files that hold class names but reach no page. Strapi joins each pattern to a scan root\nconst EXCLUDED_SOURCES = [\n '**/node_modules/**',\n '**/__tests__/**',\n '**/*.test.*',\n '**/*.spec.*',\n '**/*.stories.*',\n '**/*.d.ts',\n '**/*.map',\n];\n\nconst getSourceLines = (roots: string[]): string =>\n roots\n .map(toGlobPath)\n .flatMap((root) => [\n `@source ${toCssString(root)};`,\n ...EXCLUDED_SOURCES.map((pattern) => `@source not ${toCssString(`${root}/${pattern}`)};`),\n ])\n .join('\\n');\n\nconst DESIGN_SYSTEM_SOURCE = '@strapi/design-system/next/source.css';\n\n/**\n * Return the path of source.css in the design system copy that @strapi/admin resolves. The admin\n * JavaScript uses that copy, so the CSS must use the same copy. A plain import from the app can\n * find a different copy, for example through the pnpm folder node_modules/.pnpm/node_modules\n */\nconst getDesignSystemSourcePath = (): string => {\n const entry = getSubpathEntries('@strapi/design-system').find(\n ([key]) => key === DESIGN_SYSTEM_SOURCE\n );\n\n if (!entry) {\n throw new Error(\n `Strapi cannot resolve ${DESIGN_SYSTEM_SOURCE} from @strapi/admin. Update @strapi/strapi, so that @strapi/admin gets a @strapi/design-system release that ships the \"next\" entry.`\n );\n }\n\n return entry[1];\n};\n\nconst getStylesheet = (ctx: BuildContext): string => outdent`\n /**\n * This file was automatically generated by Strapi.\n * Any modifications made will be discarded.\n */\n @import ${toCssString(toGlobPath(getDesignSystemSourcePath()))};\n\n ${getSourceLines(ctx.scanRoots)}\n `;\n\nconst getEntryModule = (ctx: BuildContext): string => {\n const pluginsObject = ctx.plugins\n .map(({ name, importName }) => `'${name}': ${importName}`)\n .join(',\\n');\n\n const pluginsImport = ctx.plugins\n .map(({ importName, modulePath }) => `import ${importName} from '${modulePath}';`)\n .join('\\n');\n\n return outdent`\n /**\n * This file was automatically generated by Strapi.\n * Any modifications made will be discarded.\n */\n import './styles.css';\n ${pluginsImport}\n import { renderAdmin } from \"@strapi/strapi/admin\"\n\n ${\n ctx.customisations?.modulePath\n ? `import customisations from '${ctx.customisations.modulePath}'`\n : ''\n }\n\n renderAdmin(\n document.getElementById(\"strapi\"),\n {\n ${ctx.customisations?.modulePath ? 'customisations,' : ''}\n ${ctx.features ? `features: ${JSON.stringify(ctx.features)},` : ''}\n plugins: {\n ${pluginsObject}\n }\n })\n `;\n};\n\ninterface GetDocumentHTMLArgs extends Pick<BuildContext, 'logger'> {\n props?: {\n entryPath?: string;\n };\n}\n\n/**\n * TODO: Here in the future we could add the ability\n * to load a user's Document component?\n */\nconst getDocumentHTML = ({ logger, props = {} }: GetDocumentHTMLArgs) => {\n const result = renderToStaticMarkup(createElement(DefaultDocument, props));\n logger.debug('Rendered the HTML');\n\n return outdent`<!DOCTYPE html>${result}`;\n};\n\nconst AUTO_GENERATED_WARNING = `\nThis file was automatically generated by Strapi.\nAny modifications made will be discarded.\n`.trim();\n\n/**\n * Because we now auto-generate the index.html file,\n * we should be clear that people _should not_ modify it.\n *\n * @internal\n */\nconst decorateHTMLWithAutoGeneratedWarning = (htmlTemplate: string): string =>\n htmlTemplate.replace(/<head/, `\\n<!--\\n${AUTO_GENERATED_WARNING}\\n-->\\n<head`);\n\nconst writeStaticClientFiles = async (ctx: BuildContext) => {\n const prettier = await import('prettier'); // ESM-only\n\n /**\n * For everything to work effectively we create a client folder in `.strapi` at the cwd level.\n * We then use the function we need to \"createAdmin\" as well as generate the Document index.html as well.\n *\n * All this links together an imaginary \"src/index\" that then allows vite to correctly build the admin panel.\n */\n\n await fs.mkdir(ctx.runtimeDir, { recursive: true });\n ctx.logger.debug('Created the runtime directory');\n\n const indexHtml = decorateHTMLWithAutoGeneratedWarning(\n await getDocumentHTML({\n logger: ctx.logger,\n props:\n ctx.bundler === 'vite'\n ? {\n entryPath: `/${ctx.entry}`,\n }\n : undefined,\n })\n );\n\n await fs.writeFile(\n path.join(ctx.runtimeDir, 'index.html'),\n await prettier.format(indexHtml, {\n parser: 'html',\n })\n );\n ctx.logger.debug('Wrote the index.html file');\n await fs.writeFile(\n path.join(ctx.runtimeDir, 'app.js'),\n await prettier.format(getEntryModule(ctx), {\n parser: 'babel',\n })\n );\n ctx.logger.debug('Wrote the app.js file');\n await fs.writeFile(path.join(ctx.runtimeDir, 'styles.css'), getStylesheet(ctx));\n ctx.logger.debug('Wrote the styles.css file');\n};\n\nexport { writeStaticClientFiles, getDocumentHTML, getStylesheet, getEntryModule };\n"],"names":["toCssString","value","includes","Error","EXCLUDED_SOURCES","getSourceLines","roots","map","toGlobPath","flatMap","root","pattern","join","DESIGN_SYSTEM_SOURCE","getDesignSystemSourcePath","entry","getSubpathEntries","find","key","getStylesheet","ctx","outdent","scanRoots","getEntryModule","pluginsObject","plugins","name","importName","pluginsImport","modulePath","customisations","features","JSON","stringify","getDocumentHTML","logger","props","result","renderToStaticMarkup","createElement","DefaultDocument","debug","AUTO_GENERATED_WARNING","trim","decorateHTMLWithAutoGeneratedWarning","htmlTemplate","replace","writeStaticClientFiles","prettier","fs","mkdir","runtimeDir","recursive","indexHtml","bundler","entryPath","undefined","writeFile","path","format","parser"],"mappings":";;;;;;;;;;;;;;;;;AAYA;;;IAIA,MAAMA,cAAc,CAACC,KAAAA,GAAAA;AACnB,IAAA,IAAI,CAACA,KAAAA,CAAMC,QAAQ,CAAC,GAAA,CAAA,EAAM;AACxB,QAAA,OAAO,CAAC,CAAC,EAAED,KAAAA,C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AA,EAAQ;AACV,KAAA,CAAA,CAAA;IAEFxC,GAAAA,CAAIe,MAAM,CAACM,KAAK,CAAC,2BAAA,CAAA;AACjB,IAAA,MAAMQ,mBAAAA,CAAGQ,SAAS,CAChBC,qBAAAA,CAAK9C,IAAI,CAACQ,GAAAA,CAAI+B,UAAU,EAAE,WAC1B,MAAMH,QAAAA,CAASW,MAAM,CAACpC,eAAeH,GAAAA,CAAAA,EAAM;QACzCwC,MAAAA,EAAQ;AACV,KAAA,CAAA,CAAA;IAEFxC,GAAAA,CAAIe,MAAM,CAACM,KAAK,CAAC,uBAAA,CAAA;IACjB,MAAMQ,mBAAAA,CAAGQ,SAAS,CAACC,qBAAAA,CAAK9C,IAAI,CAACQ,GAAAA,CAAI+B,UAAU,EAAE,YAAA,CAAA,EAAehC,aAAAA,CAAcC,GAAAA,CAAAA,CAAAA;IAC1EA,GAAAA,CAAIe,MAAM,CAACM,KAAK,CAAC,2BAAA,CAAA;AACnB;;;;;;;"}
|
|
@@ -4,6 +4,7 @@ import outdent from 'outdent';
|
|
|
4
4
|
import { createElement } from 'react';
|
|
5
5
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
6
6
|
import { DefaultDocument } from '@strapi/admin/_internal';
|
|
7
|
+
import { getSubpathEntries } from './core/admin-vite-aliases.mjs';
|
|
7
8
|
import { toGlobPath } from './core/scan-roots.mjs';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -32,12 +33,24 @@ const getSourceLines = (roots)=>roots.map(toGlobPath).flatMap((root)=>[
|
|
|
32
33
|
`@source ${toCssString(root)};`,
|
|
33
34
|
...EXCLUDED_SOURCES.map((pattern)=>`@source not ${toCssString(`${root}/${pattern}`)};`)
|
|
34
35
|
]).join('\n');
|
|
36
|
+
const DESIGN_SYSTEM_SOURCE = '@strapi/design-system/next/source.css';
|
|
37
|
+
/**
|
|
38
|
+
* Return the path of source.css in the design system copy that @strapi/admin resolves. The admin
|
|
39
|
+
* JavaScript uses that copy, so the CSS must use the same copy. A plain import from the app can
|
|
40
|
+
* find a different copy, for example through the pnpm folder node_modules/.pnpm/node_modules
|
|
41
|
+
*/ const getDesignSystemSourcePath = ()=>{
|
|
42
|
+
const entry = getSubpathEntries('@strapi/design-system').find(([key])=>key === DESIGN_SYSTEM_SOURCE);
|
|
43
|
+
if (!entry) {
|
|
44
|
+
throw new Error(`Strapi cannot resolve ${DESIGN_SYSTEM_SOURCE} from @strapi/admin. Update @strapi/strapi, so that @strapi/admin gets a @strapi/design-system release that ships the "next" entry.`);
|
|
45
|
+
}
|
|
46
|
+
return entry[1];
|
|
47
|
+
};
|
|
35
48
|
const getStylesheet = (ctx)=>outdent`
|
|
36
49
|
/**
|
|
37
50
|
* This file was automatically generated by Strapi.
|
|
38
51
|
* Any modifications made will be discarded.
|
|
39
52
|
*/
|
|
40
|
-
@import
|
|
53
|
+
@import ${toCssString(toGlobPath(getDesignSystemSourcePath()))};
|
|
41
54
|
|
|
42
55
|
${getSourceLines(ctx.scanRoots)}
|
|
43
56
|
`;
|
|
@@ -49,7 +62,7 @@ const getEntryModule = (ctx)=>{
|
|
|
49
62
|
* This file was automatically generated by Strapi.
|
|
50
63
|
* Any modifications made will be discarded.
|
|
51
64
|
*/
|
|
52
|
-
|
|
65
|
+
import './styles.css';
|
|
53
66
|
${pluginsImport}
|
|
54
67
|
import { renderAdmin } from "@strapi/strapi/admin"
|
|
55
68
|
|
|
@@ -109,10 +122,8 @@ const writeStaticClientFiles = async (ctx)=>{
|
|
|
109
122
|
parser: 'babel'
|
|
110
123
|
}));
|
|
111
124
|
ctx.logger.debug('Wrote the app.js file');
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
ctx.logger.debug('Wrote the styles.css file');
|
|
115
|
-
}
|
|
125
|
+
await fs.writeFile(path.join(ctx.runtimeDir, 'styles.css'), getStylesheet(ctx));
|
|
126
|
+
ctx.logger.debug('Wrote the styles.css file');
|
|
116
127
|
};
|
|
117
128
|
|
|
118
129
|
export { getDocumentHTML, getEntryModule, getStylesheet, writeStaticClientFiles };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticFiles.mjs","sources":["../../../src/node/staticFiles.ts"],"sourcesContent":["import fs from 'node:fs/promises';\nimport path from 'node:path';\nimport outdent from 'outdent';\nimport { createElement } from 'react';\nimport { renderToStaticMarkup } from 'react-dom/server';\nimport { DefaultDocument } from '@strapi/admin/_internal';\n\nimport { toGlobPath } from './core/scan-roots';\n\nimport type { BuildContext } from './create-build-context';\n\n/**\n * Quote an `@source` path with a quote character the path does not hold. Tailwind decodes no\n * backslash escape, so an escape breaks both the path and any glob metacharacter such as `(x86)`\n */\nconst toCssString = (value: string): string => {\n if (!value.includes('\"')) {\n return `\"${value}\"`;\n }\n\n if (!value.includes(\"'\")) {\n return `'${value}'`;\n }\n\n throw new Error(\n `Strapi cannot write \"${value}\" into the admin stylesheet, because the path holds both quote characters. Move the directory.`\n );\n};\n\n// Files that hold class names but reach no page. Strapi joins each pattern to a scan root\nconst EXCLUDED_SOURCES = [\n '**/node_modules/**',\n '**/__tests__/**',\n '**/*.test.*',\n '**/*.spec.*',\n '**/*.stories.*',\n '**/*.d.ts',\n '**/*.map',\n];\n\nconst getSourceLines = (roots: string[]): string =>\n roots\n .map(toGlobPath)\n .flatMap((root) => [\n `@source ${toCssString(root)};`,\n ...EXCLUDED_SOURCES.map((pattern) => `@source not ${toCssString(`${root}/${pattern}`)};`),\n ])\n .join('\\n');\n\nconst getStylesheet = (ctx: BuildContext): string => outdent`\n /**\n * This file was automatically generated by Strapi.\n * Any modifications made will be discarded.\n */\n @import '@strapi/strapi/admin/styles.css';\n\n ${getSourceLines(ctx.scanRoots)}\n `;\n\nconst getEntryModule = (ctx: BuildContext): string => {\n const pluginsObject = ctx.plugins\n .map(({ name, importName }) => `'${name}': ${importName}`)\n .join(',\\n');\n\n const pluginsImport = ctx.plugins\n .map(({ importName, modulePath }) => `import ${importName} from '${modulePath}';`)\n .join('\\n');\n\n return outdent`\n /**\n * This file was automatically generated by Strapi.\n * Any modifications made will be discarded.\n */\n ${ctx.nextDesignSystem ? \"import './styles.css';\" : ''}\n ${pluginsImport}\n import { renderAdmin } from \"@strapi/strapi/admin\"\n\n ${\n ctx.customisations?.modulePath\n ? `import customisations from '${ctx.customisations.modulePath}'`\n : ''\n }\n\n renderAdmin(\n document.getElementById(\"strapi\"),\n {\n ${ctx.customisations?.modulePath ? 'customisations,' : ''}\n ${ctx.features ? `features: ${JSON.stringify(ctx.features)},` : ''}\n plugins: {\n ${pluginsObject}\n }\n })\n `;\n};\n\ninterface GetDocumentHTMLArgs extends Pick<BuildContext, 'logger'> {\n props?: {\n entryPath?: string;\n };\n}\n\n/**\n * TODO: Here in the future we could add the ability\n * to load a user's Document component?\n */\nconst getDocumentHTML = ({ logger, props = {} }: GetDocumentHTMLArgs) => {\n const result = renderToStaticMarkup(createElement(DefaultDocument, props));\n logger.debug('Rendered the HTML');\n\n return outdent`<!DOCTYPE html>${result}`;\n};\n\nconst AUTO_GENERATED_WARNING = `\nThis file was automatically generated by Strapi.\nAny modifications made will be discarded.\n`.trim();\n\n/**\n * Because we now auto-generate the index.html file,\n * we should be clear that people _should not_ modify it.\n *\n * @internal\n */\nconst decorateHTMLWithAutoGeneratedWarning = (htmlTemplate: string): string =>\n htmlTemplate.replace(/<head/, `\\n<!--\\n${AUTO_GENERATED_WARNING}\\n-->\\n<head`);\n\nconst writeStaticClientFiles = async (ctx: BuildContext) => {\n const prettier = await import('prettier'); // ESM-only\n\n /**\n * For everything to work effectively we create a client folder in `.strapi` at the cwd level.\n * We then use the function we need to \"createAdmin\" as well as generate the Document index.html as well.\n *\n * All this links together an imaginary \"src/index\" that then allows vite to correctly build the admin panel.\n */\n\n await fs.mkdir(ctx.runtimeDir, { recursive: true });\n ctx.logger.debug('Created the runtime directory');\n\n const indexHtml = decorateHTMLWithAutoGeneratedWarning(\n await getDocumentHTML({\n logger: ctx.logger,\n props:\n ctx.bundler === 'vite'\n ? {\n entryPath: `/${ctx.entry}`,\n }\n : undefined,\n })\n );\n\n await fs.writeFile(\n path.join(ctx.runtimeDir, 'index.html'),\n await prettier.format(indexHtml, {\n parser: 'html',\n })\n );\n ctx.logger.debug('Wrote the index.html file');\n await fs.writeFile(\n path.join(ctx.runtimeDir, 'app.js'),\n await prettier.format(getEntryModule(ctx), {\n parser: 'babel',\n })\n );\n ctx.logger.debug('Wrote the app.js file');\n\n if (ctx.nextDesignSystem) {\n await fs.writeFile(path.join(ctx.runtimeDir, 'styles.css'), getStylesheet(ctx));\n ctx.logger.debug('Wrote the styles.css file');\n }\n};\n\nexport { writeStaticClientFiles, getDocumentHTML, getStylesheet, getEntryModule };\n"],"names":["toCssString","value","includes","Error","EXCLUDED_SOURCES","getSourceLines","roots","map","toGlobPath","flatMap","root","pattern","join","getStylesheet","ctx","outdent","scanRoots","getEntryModule","pluginsObject","plugins","name","importName","pluginsImport","modulePath","nextDesignSystem","customisations","features","JSON","stringify","getDocumentHTML","logger","props","result","renderToStaticMarkup","createElement","DefaultDocument","debug","AUTO_GENERATED_WARNING","trim","decorateHTMLWithAutoGeneratedWarning","htmlTemplate","replace","writeStaticClientFiles","prettier","fs","mkdir","runtimeDir","recursive","indexHtml","bundler","entryPath","entry","undefined","writeFile","path","format","parser"],"mappings":";;;;;;;;AAWA;;;IAIA,MAAMA,cAAc,CAACC,KAAAA,GAAAA;AACnB,IAAA,IAAI,CAACA,KAAAA,CAAMC,QAAQ,CAAC,GAAA,CAAA,EAAM;AACxB,QAAA,OAAO,CAAC,CAAC,EAAED,KAAAA,CAAM,CAAC,CAAC;AACrB,IAAA;AAEA,IAAA,IAAI,CAACA,KAAAA,CAAMC,QAAQ,CAAC,GAAA,CAAA,EAAM;AACxB,QAAA,OAAO,CAAC,CAAC,EAAED,KAAAA,CAAM,CAAC,CAAC;AACrB,IAAA;AAEA,IAAA,MAAM,IAAIE,KAAAA,CACR,CAAC,qBAAqB,EAAEF,KAAAA,CAAM,8FAA8F,CAAC,CAAA;AAEjI,CAAA;A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],"sourcesContent":["import fs from 'node:fs/promises';\nimport path from 'node:path';\nimport outdent from 'outdent';\nimport { createElement } from 'react';\nimport { renderToStaticMarkup } from 'react-dom/server';\nimport { DefaultDocument } from '@strapi/admin/_internal';\n\nimport { getSubpathEntries } from './core/admin-vite-aliases';\nimport { toGlobPath } from './core/scan-roots';\n\nimport type { BuildContext } from './create-build-context';\n\n/**\n * Quote an `@source` path with a quote character the path does not hold. Tailwind decodes no\n * backslash escape, so an escape breaks both the path and any glob metacharacter such as `(x86)`\n */\nconst toCssString = (value: string): string => {\n if (!value.includes('\"')) {\n return `\"${value}\"`;\n }\n\n if (!value.includes(\"'\")) {\n return `'${value}'`;\n }\n\n throw new Error(\n `Strapi cannot write \"${value}\" into the admin stylesheet, because the path holds both quote characters. Move the directory.`\n );\n};\n\n// Files that hold class names but reach no page. Strapi joins each pattern to a scan root\nconst EXCLUDED_SOURCES = [\n '**/node_modules/**',\n '**/__tests__/**',\n '**/*.test.*',\n '**/*.spec.*',\n '**/*.stories.*',\n '**/*.d.ts',\n '**/*.map',\n];\n\nconst getSourceLines = (roots: string[]): string =>\n roots\n .map(toGlobPath)\n .flatMap((root) => [\n `@source ${toCssString(root)};`,\n ...EXCLUDED_SOURCES.map((pattern) => `@source not ${toCssString(`${root}/${pattern}`)};`),\n ])\n .join('\\n');\n\nconst DESIGN_SYSTEM_SOURCE = '@strapi/design-system/next/source.css';\n\n/**\n * Return the path of source.css in the design system copy that @strapi/admin resolves. The admin\n * JavaScript uses that copy, so the CSS must use the same copy. A plain import from the app can\n * find a different copy, for example through the pnpm folder node_modules/.pnpm/node_modules\n */\nconst getDesignSystemSourcePath = (): string => {\n const entry = getSubpathEntries('@strapi/design-system').find(\n ([key]) => key === DESIGN_SYSTEM_SOURCE\n );\n\n if (!entry) {\n throw new Error(\n `Strapi cannot resolve ${DESIGN_SYSTEM_SOURCE} from @strapi/admin. Update @strapi/strapi, so that @strapi/admin gets a @strapi/design-system release that ships the \"next\" entry.`\n );\n }\n\n return entry[1];\n};\n\nconst getStylesheet = (ctx: BuildContext): string => outdent`\n /**\n * This file was automatically generated by Strapi.\n * Any modifications made will be discarded.\n */\n @import ${toCssString(toGlobPath(getDesignSystemSourcePath()))};\n\n ${getSourceLines(ctx.scanRoots)}\n `;\n\nconst getEntryModule = (ctx: BuildContext): string => {\n const pluginsObject = ctx.plugins\n .map(({ name, importName }) => `'${name}': ${importName}`)\n .join(',\\n');\n\n const pluginsImport = ctx.plugins\n .map(({ importName, modulePath }) => `import ${importName} from '${modulePath}';`)\n .join('\\n');\n\n return outdent`\n /**\n * This file was automatically generated by Strapi.\n * Any modifications made will be discarded.\n */\n import './styles.css';\n ${pluginsImport}\n import { renderAdmin } from \"@strapi/strapi/admin\"\n\n ${\n ctx.customisations?.modulePath\n ? `import customisations from '${ctx.customisations.modulePath}'`\n : ''\n }\n\n renderAdmin(\n document.getElementById(\"strapi\"),\n {\n ${ctx.customisations?.modulePath ? 'customisations,' : ''}\n ${ctx.features ? `features: ${JSON.stringify(ctx.features)},` : ''}\n plugins: {\n ${pluginsObject}\n }\n })\n `;\n};\n\ninterface GetDocumentHTMLArgs extends Pick<BuildContext, 'logger'> {\n props?: {\n entryPath?: string;\n };\n}\n\n/**\n * TODO: Here in the future we could add the ability\n * to load a user's Document component?\n */\nconst getDocumentHTML = ({ logger, props = {} }: GetDocumentHTMLArgs) => {\n const result = renderToStaticMarkup(createElement(DefaultDocument, props));\n logger.debug('Rendered the HTML');\n\n return outdent`<!DOCTYPE html>${result}`;\n};\n\nconst AUTO_GENERATED_WARNING = `\nThis file was automatically generated by Strapi.\nAny modifications made will be discarded.\n`.trim();\n\n/**\n * Because we now auto-generate the index.html file,\n * we should be clear that people _should not_ modify it.\n *\n * @internal\n */\nconst decorateHTMLWithAutoGeneratedWarning = (htmlTemplate: string): string =>\n htmlTemplate.replace(/<head/, `\\n<!--\\n${AUTO_GENERATED_WARNING}\\n-->\\n<head`);\n\nconst writeStaticClientFiles = async (ctx: BuildContext) => {\n const prettier = await import('prettier'); // ESM-only\n\n /**\n * For everything to work effectively we create a client folder in `.strapi` at the cwd level.\n * We then use the function we need to \"createAdmin\" as well as generate the Document index.html as well.\n *\n * All this links together an imaginary \"src/index\" that then allows vite to correctly build the admin panel.\n */\n\n await fs.mkdir(ctx.runtimeDir, { recursive: true });\n ctx.logger.debug('Created the runtime directory');\n\n const indexHtml = decorateHTMLWithAutoGeneratedWarning(\n await getDocumentHTML({\n logger: ctx.logger,\n props:\n ctx.bundler === 'vite'\n ? {\n entryPath: `/${ctx.entry}`,\n }\n : undefined,\n })\n );\n\n await fs.writeFile(\n path.join(ctx.runtimeDir, 'index.html'),\n await prettier.format(indexHtml, {\n parser: 'html',\n })\n );\n ctx.logger.debug('Wrote the index.html file');\n await fs.writeFile(\n path.join(ctx.runtimeDir, 'app.js'),\n await prettier.format(getEntryModule(ctx), {\n parser: 'babel',\n })\n );\n ctx.logger.debug('Wrote the app.js file');\n await fs.writeFile(path.join(ctx.runtimeDir, 'styles.css'), getStylesheet(ctx));\n ctx.logger.debug('Wrote the styles.css file');\n};\n\nexport { writeStaticClientFiles, getDocumentHTML, getStylesheet, getEntryModule };\n"],"names":["toCssString","value","includes","Error","EXCLUDED_SOURCES","getSourceLines","roots","map","toGlobPath","flatMap","root","pattern","join","DESIGN_SYSTEM_SOURCE","getDesignSystemSourcePath","entry","getSubpathEntries","find","key","getStylesheet","ctx","outdent","scanRoots","getEntryModule","pluginsObject","plugins","name","importName","pluginsImport","modulePath","customisations","features","JSON","stringify","getDocumentHTML","logger","props","result","renderToStaticMarkup","createElement","DefaultDocument","debug","AUTO_GENERATED_WARNING","trim","decorateHTMLWithAutoGeneratedWarning","htmlTemplate","replace","writeStaticClientFiles","prettier","fs","mkdir","runtimeDir","recursive","indexHtml","bundler","entryPath","undefined","writeFile","path","format","parser"],"mappings":";;;;;;;;;AAYA;;;IAIA,MAAMA,cAAc,CAACC,KAAAA,GAAAA;AACnB,IAAA,IAAI,CAACA,KAAAA,CAAM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,EAC1B,MAAMH,QAAAA,CAASW,MAAM,CAACN,SAAAA,EAAW;QAC/BO,MAAAA,EAAQ;AACV,KAAA,CAAA,CAAA;IAEFxC,GAAAA,CAAIe,MAAM,CAACM,KAAK,CAAC,2BAAA,CAAA;AACjB,IAAA,MAAMQ,EAAAA,CAAGQ,SAAS,CAChBC,IAAAA,CAAK9C,IAAI,CAACQ,GAAAA,CAAI+B,UAAU,EAAE,WAC1B,MAAMH,QAAAA,CAASW,MAAM,CAACpC,eAAeH,GAAAA,CAAAA,EAAM;QACzCwC,MAAAA,EAAQ;AACV,KAAA,CAAA,CAAA;IAEFxC,GAAAA,CAAIe,MAAM,CAACM,KAAK,CAAC,uBAAA,CAAA;IACjB,MAAMQ,EAAAA,CAAGQ,SAAS,CAACC,IAAAA,CAAK9C,IAAI,CAACQ,GAAAA,CAAI+B,UAAU,EAAE,YAAA,CAAA,EAAehC,aAAAA,CAAcC,GAAAA,CAAAA,CAAAA;IAC1EA,GAAAA,CAAIe,MAAM,CAACM,KAAK,CAAC,2BAAA,CAAA;AACnB;;;;"}
|
|
@@ -30,11 +30,9 @@ const resolveBaseConfig = async (ctx)=>{
|
|
|
30
30
|
// its CJS entry, which emits "The CJS build of Vite's Node API is deprecated".
|
|
31
31
|
// https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated
|
|
32
32
|
const { default: react } = await import('@vitejs/plugin-react-swc');
|
|
33
|
-
// Imported dynamically
|
|
34
|
-
//
|
|
35
|
-
const
|
|
36
|
-
(await import('@tailwindcss/vite')).default()
|
|
37
|
-
] : [];
|
|
33
|
+
// Imported dynamically, because the CJS build turns a static import into a require() of an
|
|
34
|
+
// ESM-only package, which Node before 22.12 cannot load
|
|
35
|
+
const { default: tailwindcss } = await import('@tailwindcss/vite');
|
|
38
36
|
return {
|
|
39
37
|
root: ctx.cwd,
|
|
40
38
|
base: ctx.basePath,
|
|
@@ -167,7 +165,7 @@ const resolveBaseConfig = async (ctx)=>{
|
|
|
167
165
|
alias: adminViteAliases.buildAdminViteResolveAliases()
|
|
168
166
|
},
|
|
169
167
|
plugins: [
|
|
170
|
-
|
|
168
|
+
tailwindcss(),
|
|
171
169
|
react(),
|
|
172
170
|
plugins.buildFilesPlugin(ctx)
|
|
173
171
|
]
|
|
@@ -187,7 +185,7 @@ const resolveProductionConfig = async (ctx)=>{
|
|
|
187
185
|
sourcemap,
|
|
188
186
|
rollupOptions: {
|
|
189
187
|
input: {
|
|
190
|
-
strapi:
|
|
188
|
+
strapi: path__default.default.join(ctx.runtimeDir, 'index.html')
|
|
191
189
|
}
|
|
192
190
|
}
|
|
193
191
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","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/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,qBAAAA,CAAsBF,GAAAA,CAAIG,MAAM,CAAA;AAC/C,IAAA,MAAMC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AACP,YAAA,GAAGU,WAAWV,OAAO;YACrBG,KAAAA,EAAO;gBACL,GAAGO,UAAAA,CAAWV,OAAO,EAAEG,KAAK;AAC5B,gBAAA,GAAGoB,0BAAAA,CAAmB;AAAEF,8BAAAA;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,QAAAA,EAAsB1E,GAAAA,GAAAA;IAC7D,MAAM2E,UAAAA,GAAa,MAAMC,oBAAAA,CAA8BJ,YAAAA,EAAcxE,GAAAA,CAAAA;AAErE,IAAA,IAAI2E,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 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 // Imported dynamically, because the CJS build turns a static import into a require() of an\n // ESM-only package, which Node before 22.12 cannot load\n const { default: tailwindcss } = await import('@tailwindcss/vite');\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/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: [tailwindcss(), 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: path.join(ctx.runtimeDir, 'index.html'),\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","tailwindcss","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","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,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;AAC3B,IAAA,MAAMC,4BAA4B,MAAMC,wDAAAA,CAAgCX,IAAIY,GAAG,EAAEZ,IAAIa,OAAO,CAAA;AAC5F,IAAA,MAAMC,mBAAAA,GAAsB;WACtBN,kBAAAA,GAAqB;AAAC,YAAA;AAAwB,SAAA,GAAG,EAAE;AACpDE,QAAAA,GAAAA;AACJ,KAAA;;;;AAKD,IAAA,MAAM,EAAET,OAAAA,EAASc,KAAK,EAAE,GAAG,MAAM,OAAO,0BAAA,CAAA;;;AAGxC,IAAA,MAAM,EAAEd,OAAAA,EAASe,WAAW,EAAE,GAAG,MAAM,OAAO,mBAAA,CAAA;IAE9C,OAAO;AACLC,QAAAA,IAAAA,EAAMjB,IAAIY,GAAG;AACbM,QAAAA,IAAAA,EAAMlB,IAAImB,QAAQ;;;QAGlBC,SAAAA,EAAW,KAAA;QACXC,KAAAA,EAAO;YACLC,WAAAA,EAAa,KAAA;AACbC,YAAAA,MAAAA,EAAQvB,IAAIwB,OAAO;AACnBrB,YAAAA;AACF,SAAA;QACAsB,QAAAA,EAAU,2BAAA;QACVC,UAAAA,EAAY,KA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resolveBaseConfig = async (ctx)=>{
|
|
|
24
24
|
// its CJS entry, which emits "The CJS build of Vite's Node API is deprecated".
|
|
25
25
|
// https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated
|
|
26
26
|
const { default: react } = await import('@vitejs/plugin-react-swc');
|
|
27
|
-
// Imported dynamically
|
|
28
|
-
//
|
|
29
|
-
const
|
|
30
|
-
(await import('@tailwindcss/vite')).default()
|
|
31
|
-
] : [];
|
|
27
|
+
// Imported dynamically, because the CJS build turns a static import into a require() of an
|
|
28
|
+
// ESM-only package, which Node before 22.12 cannot load
|
|
29
|
+
const { default: tailwindcss } = await import('@tailwindcss/vite');
|
|
32
30
|
return {
|
|
33
31
|
root: ctx.cwd,
|
|
34
32
|
base: ctx.basePath,
|
|
@@ -161,7 +159,7 @@ const resolveBaseConfig = async (ctx)=>{
|
|
|
161
159
|
alias: buildAdminViteResolveAliases()
|
|
162
160
|
},
|
|
163
161
|
plugins: [
|
|
164
|
-
|
|
162
|
+
tailwindcss(),
|
|
165
163
|
react(),
|
|
166
164
|
buildFilesPlugin(ctx)
|
|
167
165
|
]
|
|
@@ -181,7 +179,7 @@ const resolveProductionConfig = async (ctx)=>{
|
|
|
181
179
|
sourcemap,
|
|
182
180
|
rollupOptions: {
|
|
183
181
|
input: {
|
|
184
|
-
strapi:
|
|
182
|
+
strapi: path.join(ctx.runtimeDir, 'index.html')
|
|
185
183
|
}
|
|
186
184
|
}
|
|
187
185
|
}
|
|
@@ -1 +1 @@
|
|
|
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/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,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,CAAgCX,IAAIY,GAAG,EAAEZ,IAAIa,OAAO,CAAA;AAC5F,IAAA,MAAMC,mBAAAA,GAAsB;WACtBN,kBAAAA,GAAqB;AAAC,YAAA;AAAwB,SAAA,GAAG,EAAE;AACpDE,QAAAA,GAAAA;AACJ,KAAA;;;;AAKD,IAAA,MAAM,EAAET,OAAAA,EAASc,KAAK,EAAE,GAAG,MAAM,OAAO,0BAAA,CAAA;;;IAIxC,MAAMC,eAAAA,GAAkBhB,GAAAA,CAAIiB,gBAAgB,GACxC;AAAE,QAAA,CAAA,MAAM,OAAO,mBAAA,CAAmB,EAAGhB,OAAO;AAAG,KAAA,GAC/C,EAAE;IAEN,OAAO;AACLiB,QAAAA,IAAAA,EAAMlB,IAAIY,GAAG;AACbO,QAAAA,IAAAA,EAAMnB,IAAIoB,QAAQ;;;QAGlBC,SAAAA,EAAW,KAAA;QACXC,KAA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A,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
|
+
{"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 // Imported dynamically, because the CJS build turns a static import into a require() of an\n // ESM-only package, which Node before 22.12 cannot load\n const { default: tailwindcss } = await import('@tailwindcss/vite');\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/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: [tailwindcss(), 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: path.join(ctx.runtimeDir, 'index.html'),\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","tailwindcss","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","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,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,CAAgCX,IAAIY,GAAG,EAAEZ,IAAIa,OAAO,CAAA;AAC5F,IAAA,MAAMC,mBAAAA,GAAsB;WACtBN,kBAAAA,GAAqB;AAAC,YAAA;AAAwB,SAAA,GA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A,CAAIK,MAAM,CAACwD,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,EAAsBxE,GAAAA,GAAAA;IAC7D,MAAMyE,UAAAA,GAAa,MAAMC,aAAAA,CAA8BJ,YAAAA,EAActE,GAAAA,CAAAA;AAErE,IAAA,IAAIyE,UAAAA,EAAY;AACd,QAAA,OAAOA,UAAAA,CAAWD,MAAAA,CAAAA;AACpB,IAAA;IAEA,OAAOA,MAAAA;AACT;;;;"}
|
|
@@ -1,24 +1,55 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var path = require('node:path');
|
|
4
|
-
var staticFiles = require('../staticFiles.js');
|
|
5
4
|
|
|
6
5
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
6
|
|
|
8
7
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
9
8
|
|
|
10
|
-
const
|
|
9
|
+
const buildFilesPlugin = (ctx)=>{
|
|
10
|
+
const htmlPath = path__default.default.join(ctx.runtimeDir, 'index.html');
|
|
11
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,
|
|
12
|
+
const htmlKey = path__default.default.relative(ctx.cwd, htmlPath).split(path__default.default.sep).join('/');
|
|
13
13
|
return {
|
|
14
14
|
name: 'strapi/server/build-files',
|
|
15
15
|
apply: 'build',
|
|
16
16
|
// Run after Vite's build:html plugin, which is what emits the html asset
|
|
17
17
|
enforce: 'post',
|
|
18
|
+
// A custom src/admin/vite.config can replace build.rollupOptions.input, so add the html back
|
|
19
|
+
options (options) {
|
|
20
|
+
const { input = {} } = options;
|
|
21
|
+
if (typeof input === 'string' || Array.isArray(input)) {
|
|
22
|
+
// mergeConfig appends a user array to Strapi's default object input, so an entry can be an object
|
|
23
|
+
const entries = [
|
|
24
|
+
input
|
|
25
|
+
].flat().flatMap((entry)=>typeof entry === 'string' ? entry : Object.values(entry));
|
|
26
|
+
return {
|
|
27
|
+
...options,
|
|
28
|
+
input: entries.includes(htmlPath) ? entries : [
|
|
29
|
+
...entries,
|
|
30
|
+
htmlPath
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (Object.values(input).includes(htmlPath)) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
let key = 'strapi-admin';
|
|
38
|
+
for(let i = 1; Object.hasOwn(input, key); i += 1){
|
|
39
|
+
key = `strapi-admin-${i}`;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
...options,
|
|
43
|
+
input: {
|
|
44
|
+
...input,
|
|
45
|
+
[key]: htmlPath
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
},
|
|
18
49
|
async generateBundle (_options, outputBundle) {
|
|
19
50
|
const asset = outputBundle[htmlKey];
|
|
20
51
|
if (!asset) {
|
|
21
|
-
throw new Error(`Failed to find the html asset in bundle (${htmlKey}). Vite must build that file;
|
|
52
|
+
throw new Error(`Failed to find the html asset in bundle (${htmlKey}). Vite must build that file; check that no plugin removes it from build.rollupOptions.input`);
|
|
22
53
|
}
|
|
23
54
|
asset.fileName = 'index.html';
|
|
24
55
|
outputBundle['index.html'] = asset;
|
|
@@ -26,47 +57,6 @@ const htmlEntryPlugin = (ctx)=>{
|
|
|
26
57
|
}
|
|
27
58
|
};
|
|
28
59
|
};
|
|
29
|
-
// Flag-off build, identical to the build before the flag. Delete it when the flag goes
|
|
30
|
-
const legacyBuildFilesPlugin = (ctx)=>{
|
|
31
|
-
const CHUNK_ID = '.strapi/client/app.js';
|
|
32
|
-
return {
|
|
33
|
-
name: 'strapi/server/build-files',
|
|
34
|
-
apply: 'build',
|
|
35
|
-
buildStart () {
|
|
36
|
-
this.emitFile({
|
|
37
|
-
type: 'chunk',
|
|
38
|
-
id: CHUNK_ID,
|
|
39
|
-
name: 'strapi'
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
async generateBundle (_options, outputBundle) {
|
|
43
|
-
const bundle = outputBundle;
|
|
44
|
-
const entryFile = Object.values(bundle).find((file)=>file.type === 'chunk' && file.name === 'strapi' && file.facadeModuleId?.endsWith(CHUNK_ID));
|
|
45
|
-
if (!entryFile) {
|
|
46
|
-
throw new Error(`Failed to find entry file in bundle (${CHUNK_ID})`);
|
|
47
|
-
}
|
|
48
|
-
if (entryFile.type !== 'chunk') {
|
|
49
|
-
throw new Error('Entry file is not a chunk');
|
|
50
|
-
}
|
|
51
|
-
const entryFileName = entryFile.fileName;
|
|
52
|
-
const entryPath = [
|
|
53
|
-
ctx.basePath.replace(/\/+$/, ''),
|
|
54
|
-
entryFileName
|
|
55
|
-
].join('/');
|
|
56
|
-
this.emitFile({
|
|
57
|
-
type: 'asset',
|
|
58
|
-
fileName: 'index.html',
|
|
59
|
-
source: staticFiles.getDocumentHTML({
|
|
60
|
-
logger: ctx.logger,
|
|
61
|
-
props: {
|
|
62
|
-
entryPath
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
const buildFilesPlugin = (ctx)=>ctx.nextDesignSystem ? htmlEntryPlugin(ctx) : legacyBuildFilesPlugin(ctx);
|
|
70
60
|
|
|
71
61
|
exports.buildFilesPlugin = buildFilesPlugin;
|
|
72
62
|
//# sourceMappingURL=plugins.js.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 type { BuildContext } from '../create-build-context';\n\ntype BuildFilesContext = Pick<BuildContext, 'cwd' | 'runtimeDir'>;\n\nconst buildFilesPlugin = (ctx: BuildFilesContext): Plugin => {\n const htmlPath = path.join(ctx.runtimeDir, 'index.html');\n // Vite keys the html asset by its path from the root, so move it to the top level\n const htmlKey = path.relative(ctx.cwd, htmlPath).split(path.sep).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 // A custom src/admin/vite.config can replace build.rollupOptions.input, so add the html back\n options(options) {\n const { input = {} } = options;\n\n if (typeof input === 'string' || Array.isArray(input)) {\n // mergeConfig appends a user array to Strapi's default object input, so an entry can be an object\n const entries = [input]\n .flat()\n .flatMap((entry: string | Record<string, string>) =>\n typeof entry === 'string' ? entry : Object.values(entry)\n );\n\n return { ...options, input: entries.includes(htmlPath) ? entries : [...entries, htmlPath] };\n }\n\n if (Object.values(input).includes(htmlPath)) {\n return null;\n }\n\n let key = 'strapi-admin';\n for (let i = 1; Object.hasOwn(input, key); i += 1) {\n key = `strapi-admin-${i}`;\n }\n\n return { ...options, input: { ...input, [key]: htmlPath } };\n },\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; check that no plugin removes it from build.rollupOptions.input`\n );\n }\n\n asset.fileName = 'index.html';\n outputBundle['index.html'] = asset;\n delete outputBundle[htmlKey];\n },\n };\n};\n\nexport { buildFilesPlugin };\n"],"names":["buildFilesPlugin","ctx","htmlPath","path","join","runtimeDir","htmlKey","relative","cwd","split","sep","name","apply","enforce","options","input","Array","isArray","entries","flat","flatMap","entry","Object","values","includes","key","i","hasOwn","generateBundle","_options","outputBundle","asset","Error","fileName"],"mappings":";;;;;;;;AAQA,MAAMA,mBAAmB,CAACC,GAAAA,GAAAA;AACxB,IAAA,MAAMC,W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