@strapi/strapi 5.55.0 → 5.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/admin-styles.css +5 -0
  2. package/dist/node/core/admin-vite-aliases.d.ts +9 -0
  3. package/dist/node/core/admin-vite-aliases.d.ts.map +1 -1
  4. package/dist/node/core/aliases.d.ts +4 -1
  5. package/dist/node/core/aliases.d.ts.map +1 -1
  6. package/dist/node/core/scan-roots.d.ts +20 -0
  7. package/dist/node/core/scan-roots.d.ts.map +1 -0
  8. package/dist/node/create-build-context.d.ts +10 -1
  9. package/dist/node/create-build-context.d.ts.map +1 -1
  10. package/dist/node/develop.d.ts.map +1 -1
  11. package/dist/node/staticFiles.d.ts +3 -1
  12. package/dist/node/staticFiles.d.ts.map +1 -1
  13. package/dist/node/vite/config.d.ts.map +1 -1
  14. package/dist/node/vite/plugins.d.ts +2 -1
  15. package/dist/node/vite/plugins.d.ts.map +1 -1
  16. package/dist/node/vite/plugins.test.d.ts +2 -0
  17. package/dist/node/vite/plugins.test.d.ts.map +1 -0
  18. package/dist/package.json.js +1 -1
  19. package/dist/package.json.mjs +1 -1
  20. package/dist/src/node/core/admin-vite-aliases.js +51 -0
  21. package/dist/src/node/core/admin-vite-aliases.js.map +1 -1
  22. package/dist/src/node/core/admin-vite-aliases.mjs +46 -1
  23. package/dist/src/node/core/admin-vite-aliases.mjs.map +1 -1
  24. package/dist/src/node/core/aliases.js +6 -0
  25. package/dist/src/node/core/aliases.js.map +1 -1
  26. package/dist/src/node/core/aliases.mjs +6 -1
  27. package/dist/src/node/core/aliases.mjs.map +1 -1
  28. package/dist/src/node/core/scan-roots.js +87 -0
  29. package/dist/src/node/core/scan-roots.js.map +1 -0
  30. package/dist/src/node/core/scan-roots.mjs +79 -0
  31. package/dist/src/node/core/scan-roots.mjs.map +1 -0
  32. package/dist/src/node/create-build-context.js +40 -1
  33. package/dist/src/node/create-build-context.js.map +1 -1
  34. package/dist/src/node/create-build-context.mjs +40 -1
  35. package/dist/src/node/create-build-context.mjs.map +1 -1
  36. package/dist/src/node/develop.js +2 -1
  37. package/dist/src/node/develop.js.map +1 -1
  38. package/dist/src/node/develop.mjs +2 -1
  39. package/dist/src/node/develop.mjs.map +1 -1
  40. package/dist/src/node/staticFiles.js +43 -0
  41. package/dist/src/node/staticFiles.js.map +1 -1
  42. package/dist/src/node/staticFiles.mjs +42 -1
  43. package/dist/src/node/staticFiles.mjs.map +1 -1
  44. package/dist/src/node/vite/config.js +12 -1
  45. package/dist/src/node/vite/config.js.map +1 -1
  46. package/dist/src/node/vite/config.mjs +8 -1
  47. package/dist/src/node/vite/config.mjs.map +1 -1
  48. package/dist/src/node/vite/plugins.js +27 -1
  49. package/dist/src/node/vite/plugins.js.map +1 -1
  50. package/dist/src/node/vite/plugins.mjs +23 -1
  51. package/dist/src/node/vite/plugins.mjs.map +1 -1
  52. package/package.json +30 -25
@@ -0,0 +1,79 @@
1
+ import { createRequire } from 'node:module';
2
+ import path from 'node:path';
3
+ import { getMonorepoAliases, getMonorepoEeAdminSource } from './aliases.mjs';
4
+ import { loadStrapiMonorepo } from './monorepo.mjs';
5
+
6
+ /** The `@strapi/strapi` dependencies that `src/admin.ts` imports, so no plugin walk finds them */ const HOST_ADMIN_PACKAGES = [
7
+ '@strapi/admin',
8
+ '@strapi/content-type-builder',
9
+ '@strapi/content-manager',
10
+ '@strapi/email',
11
+ '@strapi/upload',
12
+ '@strapi/i18n',
13
+ '@strapi/content-releases',
14
+ '@strapi/review-workflows'
15
+ ];
16
+ /**
17
+ * The directories Tailwind scans for class names. Tailwind never looks in `node_modules`, so the
18
+ * stylesheet must name every directory that holds admin code.
19
+ *
20
+ * @param dev - true for the Vite development server, which serves `admin/src`. Tailwind must scan
21
+ * what Vite serves. Every other case scans `dist`
22
+ */ const getScanRoots = async (ctx, dev)=>{
23
+ const requireFromEntry = createRequire(path.join(ctx.runtimeDir, 'app.js'));
24
+ const monorepo = dev ? await loadStrapiMonorepo(ctx.cwd) : undefined;
25
+ const aliases = getMonorepoAliases({
26
+ monorepo
27
+ });
28
+ // Under strict pnpm the `@strapi/strapi` manifest is the only place the host packages resolve
29
+ const manifestPath = require.resolve('@strapi/strapi/package.json');
30
+ const requireFromHost = createRequire(manifestPath);
31
+ const hostRoots = HOST_ADMIN_PACKAGES.map((name)=>{
32
+ const modulePath = `${name}/strapi-admin`;
33
+ // The alias wins, because it names the directory Vite serves and not an unbuilt `dist`
34
+ return aliases[modulePath] ?? path.dirname(requireFromHost.resolve(modulePath));
35
+ });
36
+ const pluginRoots = ctx.plugins.map((plugin)=>{
37
+ const alias = aliases[plugin.modulePath];
38
+ if (alias) {
39
+ return alias;
40
+ }
41
+ try {
42
+ return path.dirname(requireFromEntry.resolve(plugin.modulePath));
43
+ } catch (error) {
44
+ // Only a missing module means the plugin is unbuilt; other errors are their own problem
45
+ if (!(error instanceof Error && 'code' in error && error.code === 'MODULE_NOT_FOUND')) {
46
+ throw error;
47
+ }
48
+ throw new Error(`Cannot find the admin entry of the plugin "${plugin.name}". Build the plugin first`, {
49
+ cause: error
50
+ });
51
+ }
52
+ });
53
+ // The `@strapi/admin` alias names `admin/src` only, so the Enterprise tree is a second root
54
+ const eeAdminSource = getMonorepoEeAdminSource({
55
+ monorepo
56
+ });
57
+ const eeRoots = eeAdminSource ? [
58
+ eeAdminSource
59
+ ] : [];
60
+ const appRoots = ctx.customisations ? [
61
+ path.dirname(ctx.customisations.path)
62
+ ] : [];
63
+ // A package can be both a host dependency and an enabled plugin
64
+ return [
65
+ ...new Set([
66
+ ...hostRoots,
67
+ ...pluginRoots,
68
+ ...eeRoots,
69
+ ...appRoots
70
+ ])
71
+ ];
72
+ };
73
+ /**
74
+ * Converts a system path to the glob form the `@source` lines need. A glob separator is a forward
75
+ * slash on every platform, Windows included
76
+ */ const toGlobPath = (value)=>value.replace(/\\/g, '/');
77
+
78
+ export { HOST_ADMIN_PACKAGES, getScanRoots, toGlobPath };
79
+ //# sourceMappingURL=scan-roots.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan-roots.mjs","sources":["../../../../src/node/core/scan-roots.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport path from 'node:path';\n\nimport { getMonorepoAliases, getMonorepoEeAdminSource } from './aliases';\nimport { loadStrapiMonorepo } from './monorepo';\n\nimport type { BuildContext } from '../create-build-context';\n\n/** The `@strapi/strapi` dependencies that `src/admin.ts` imports, so no plugin walk finds them */\nconst HOST_ADMIN_PACKAGES = [\n '@strapi/admin',\n '@strapi/content-type-builder',\n '@strapi/content-manager',\n '@strapi/email',\n '@strapi/upload',\n '@strapi/i18n',\n '@strapi/content-releases',\n '@strapi/review-workflows',\n];\n\ntype ScanContext = Pick<BuildContext, 'cwd' | 'runtimeDir' | 'plugins' | 'customisations'>;\n\n/**\n * The directories Tailwind scans for class names. Tailwind never looks in `node_modules`, so the\n * stylesheet must name every directory that holds admin code.\n *\n * @param dev - true for the Vite development server, which serves `admin/src`. Tailwind must scan\n * what Vite serves. Every other case scans `dist`\n */\nconst getScanRoots = async (ctx: ScanContext, dev: boolean): Promise<string[]> => {\n const requireFromEntry = createRequire(path.join(ctx.runtimeDir, 'app.js'));\n const monorepo = dev ? await loadStrapiMonorepo(ctx.cwd) : undefined;\n const aliases = getMonorepoAliases({ monorepo });\n\n // Under strict pnpm the `@strapi/strapi` manifest is the only place the host packages resolve\n const manifestPath = require.resolve('@strapi/strapi/package.json');\n const requireFromHost = createRequire(manifestPath);\n\n const hostRoots = HOST_ADMIN_PACKAGES.map((name) => {\n const modulePath = `${name}/strapi-admin`;\n\n // The alias wins, because it names the directory Vite serves and not an unbuilt `dist`\n return aliases[modulePath] ?? path.dirname(requireFromHost.resolve(modulePath));\n });\n\n const pluginRoots = ctx.plugins.map((plugin) => {\n const alias = aliases[plugin.modulePath];\n\n if (alias) {\n return alias;\n }\n\n try {\n return path.dirname(requireFromEntry.resolve(plugin.modulePath));\n } catch (error) {\n // Only a missing module means the plugin is unbuilt; other errors are their own problem\n if (!(error instanceof Error && 'code' in error && error.code === 'MODULE_NOT_FOUND')) {\n throw error;\n }\n\n throw new Error(\n `Cannot find the admin entry of the plugin \"${plugin.name}\". Build the plugin first`,\n { cause: error }\n );\n }\n });\n\n // The `@strapi/admin` alias names `admin/src` only, so the Enterprise tree is a second root\n const eeAdminSource = getMonorepoEeAdminSource({ monorepo });\n const eeRoots = eeAdminSource ? [eeAdminSource] : [];\n\n const appRoots = ctx.customisations ? [path.dirname(ctx.customisations.path)] : [];\n\n // A package can be both a host dependency and an enabled plugin\n return [...new Set([...hostRoots, ...pluginRoots, ...eeRoots, ...appRoots])];\n};\n\n/**\n * Converts a system path to the glob form the `@source` lines need. A glob separator is a forward\n * slash on every platform, Windows included\n */\nconst toGlobPath = (value: string): string => value.replace(/\\\\/g, '/');\n\nexport { getScanRoots, toGlobPath, HOST_ADMIN_PACKAGES };\nexport type { ScanContext };\n"],"names":["HOST_ADMIN_PACKAGES","getScanRoots","ctx","dev","requireFromEntry","createRequire","path","join","runtimeDir","monorepo","loadStrapiMonorepo","cwd","undefined","aliases","getMonorepoAliases","manifestPath","require","resolve","requireFromHost","hostRoots","map","name","modulePath","dirname","pluginRoots","plugins","plugin","alias","error","Error","code","cause","eeAdminSource","getMonorepoEeAdminSource","eeRoots","appRoots","customisations","Set","toGlobPath","value","replace"],"mappings":";;;;;AAQA,yGACMA,mBAAAA,GAAsB;AAC1B,IAAA,eAAA;AACA,IAAA,8BAAA;AACA,IAAA,yBAAA;AACA,IAAA,eAAA;AACA,IAAA,gBAAA;AACA,IAAA,cAAA;AACA,IAAA,0BAAA;AACA,IAAA;AACD;AAID;;;;;;IAOA,MAAMC,YAAAA,GAAe,OAAOC,GAAAA,EAAkBC,GAAAA,GAAAA;AAC5C,IAAA,MAAMC,mBAAmBC,aAAAA,CAAcC,IAAAA,CAAKC,IAAI,CAACL,GAAAA,CAAIM,UAAU,EAAE,QAAA,CAAA,CAAA;AACjE,IAAA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aAAA,CAAA;AAEnB,QAAA;AACF,IAAA,CAAA,CAAA;;AAGA,IAAA,MAAMI,gBAAgBC,wBAAAA,CAAyB;AAAExB,QAAAA;AAAS,KAAA,CAAA;AAC1D,IAAA,MAAMyB,UAAUF,aAAAA,GAAgB;AAACA,QAAAA;AAAc,KAAA,GAAG,EAAE;IAEpD,MAAMG,QAAAA,GAAWjC,GAAAA,CAAIkC,cAAc,GAAG;AAAC9B,QAAAA,IAAAA,CAAKiB,OAAO,CAACrB,GAAAA,CAAIkC,cAAc,CAAC9B,IAAI;AAAE,KAAA,GAAG,EAAE;;IAGlF,OAAO;AAAI,QAAA,GAAA,IAAI+B,GAAAA,CAAI;AAAIlB,YAAAA,GAAAA,SAAAA;AAAcK,YAAAA,GAAAA,WAAAA;AAAgBU,YAAAA,GAAAA,OAAAA;AAAYC,YAAAA,GAAAA;AAAS,SAAA;AAAE,KAAA;AAC9E;AAEA;;;AAGC,UACKG,UAAAA,GAAa,CAACC,QAA0BA,KAAAA,CAAMC,OAAO,CAAC,KAAA,EAAO,GAAA;;;;"}
@@ -8,6 +8,8 @@ var core = require('@strapi/core');
8
8
  var env = require('./core/env.js');
9
9
  var plugins = require('./core/plugins.js');
10
10
  var adminCustomisations = require('./core/admin-customisations.js');
11
+ var scanRoots = require('./core/scan-roots.js');
12
+ var resolveModule = require('./core/resolve-module.js');
11
13
 
12
14
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
15
 
@@ -16,13 +18,31 @@ var path__default = /*#__PURE__*/_interopDefault(path);
16
18
  var fs__default = /*#__PURE__*/_interopDefault(fs);
17
19
  var browserslist__default = /*#__PURE__*/_interopDefault(browserslist);
18
20
 
21
+ const NEXT_DESIGN_SYSTEM_FLAG = 'unstableNextDesignSystem';
22
+ /** The export the flag-on stylesheet imports. Only a design system release with the `next` entry has it */ const NEXT_DESIGN_SYSTEM_ENTRY = '@strapi/design-system/next/source.css';
23
+ /** Fails the build when @strapi/admin's closure has no next design system entry, the root the Vite alias resolves from */ const assertNextDesignSystemEntry = ()=>{
24
+ try {
25
+ resolveModule.getModulePath(NEXT_DESIGN_SYSTEM_ENTRY);
26
+ } catch {
27
+ throw new Error([
28
+ `The ${NEXT_DESIGN_SYSTEM_FLAG} future flag needs a @strapi/design-system release that ships the "next" entry, but ${NEXT_DESIGN_SYSTEM_ENTRY} does not resolve.`,
29
+ 'Point the application package.json at such a release:',
30
+ '',
31
+ '"resolutions": { "@strapi/design-system": "<version>" }',
32
+ '',
33
+ 'npm and pnpm users use "overrides" in place of "resolutions", with the key at the top level of the object.',
34
+ 'An entry in "dependencies" is not enough. The override must be global, so that @strapi/admin gets the same copy.',
35
+ 'The current release is the alpha dist-tag on npm, see `npm view @strapi/design-system dist-tags`.'
36
+ ].join(os__default.default.EOL));
37
+ }
38
+ };
19
39
  const DEFAULT_BROWSERSLIST = [
20
40
  'last 3 major versions',
21
41
  'Firefox ESR',
22
42
  'last 2 Opera versions',
23
43
  'not dead'
24
44
  ];
25
- const createBuildContext = async ({ cwd, logger, tsconfig, strapi, options = {} })=>{
45
+ const createBuildContext = async ({ cwd, logger, tsconfig, strapi, options = {}, dev = false })=>{
26
46
  /**
27
47
  * If you make a new strapi instance when one already exists,
28
48
  * you will overwrite the global and the app will _most likely_
@@ -100,6 +120,23 @@ const createBuildContext = async ({ cwd, logger, tsconfig, strapi, options = {}
100
120
  });
101
121
  const features = strapiInstance.config.get('features', undefined);
102
122
  const { bundler = 'vite', ...restOptions } = options;
123
+ const flagEnabled = strapiInstance.features.future.isEnabled(NEXT_DESIGN_SYSTEM_FLAG);
124
+ if (flagEnabled && bundler !== 'vite') {
125
+ logger.warn(`The ${NEXT_DESIGN_SYSTEM_FLAG} future flag needs Vite. Tailwind is not available under ${bundler}, so this build has no next design system`);
126
+ }
127
+ const nextDesignSystem = flagEnabled && bundler === 'vite';
128
+ if (nextDesignSystem) {
129
+ assertNextDesignSystemEntry();
130
+ }
131
+ const scanRoots$1 = nextDesignSystem ? await scanRoots.getScanRoots({
132
+ cwd,
133
+ runtimeDir,
134
+ plugins: pluginsWithFront,
135
+ customisations
136
+ }, dev) : [];
137
+ if (nextDesignSystem) {
138
+ logger.debug('Tailwind scan roots', os__default.default.EOL, scanRoots$1);
139
+ }
103
140
  const buildContext = {
104
141
  appDir,
105
142
  adminPath,
@@ -113,9 +150,11 @@ const createBuildContext = async ({ cwd, logger, tsconfig, strapi, options = {}
113
150
  env: env$1,
114
151
  features,
115
152
  logger,
153
+ nextDesignSystem,
116
154
  options: restOptions,
117
155
  plugins: pluginsWithFront,
118
156
  runtimeDir,
157
+ scanRoots: scanRoots$1,
119
158
  strapi: strapiInstance,
120
159
  target,
121
160
  tsconfig
@@ -1 +1 @@
1
- {"version":3,"file":"create-build-context.js","sources":["../../../src/node/create-build-context.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs/promises';\nimport browserslist from 'browserslist';\nimport { createStrapi } from '@strapi/core';\nimport type { Core, Modules } from '@strapi/types';\n\nimport type { CLIContext } from '../cli/types';\nimport { getStrapiAdminEnvVars, loadEnv } from './core/env';\n\nimport { PluginMeta, getEnabledPlugins, getMapOfPluginsWithAdmin } from './core/plugins';\nimport { AppFile, loadUserAppFile } from './core/admin-customisations';\nimport type { BaseContext } from './types';\n\ninterface BaseOptions {\n stats?: boolean;\n minify?: boolean;\n sourcemap?: boolean;\n bundler?: 'webpack' | 'vite';\n open?: boolean;\n}\n\ninterface BuildContext extends BaseContext {\n /**\n * The customisations defined by the user in their app.js file\n */\n customisations?: AppFile;\n /**\n * Features object with future flags\n */\n features?: Modules.Features.FeaturesService['config'];\n /**\n * The build options\n */\n options: BaseOptions;\n /**\n * The plugins to be included in the JS bundle\n * incl. internal plugins, third party plugins & local plugins\n */\n plugins: PluginMeta[];\n}\n\ninterface CreateBuildContextArgs extends CLIContext {\n strapi?: Core.Strapi;\n options?: BaseOptions;\n}\n\nconst DEFAULT_BROWSERSLIST = [\n 'last 3 major versions',\n 'Firefox ESR',\n 'last 2 Opera versions',\n 'not dead',\n];\n\nconst createBuildContext = async ({\n cwd,\n logger,\n tsconfig,\n strapi,\n options = {},\n}: CreateBuildContextArgs): Promise<BuildContext> => {\n /**\n * If you make a new strapi instance when one already exists,\n * you will overwrite the global and the app will _most likely_\n * crash and die.\n */\n const strapiInstance =\n strapi ??\n createStrapi({\n // Directories\n appDir: cwd,\n distDir: tsconfig?.config.options.outDir ?? '',\n // Options\n autoReload: true,\n serveAdminPanel: false,\n });\n\n const serverAbsoluteUrl = strapiInstance.config.get<string>('server.absoluteUrl');\n const adminAbsoluteUrl = strapiInstance.config.get<string>('admin.absoluteUrl');\n const adminPath = strapiInstance.config.get<string>('admin.path');\n\n // NOTE: Checks that both the server and admin will be served from the same origin (protocol, host, port)\n const sameOrigin = new URL(adminAbsoluteUrl).origin === new URL(serverAbsoluteUrl).origin;\n\n const adminPublicPath = new URL(adminAbsoluteUrl).pathname;\n const serverPublicPath = new URL(serverAbsoluteUrl).pathname;\n\n const appDir = strapiInstance.dirs.app.root;\n\n await loadEnv(cwd);\n\n const env = getStrapiAdminEnvVars({\n ADMIN_PATH: adminPublicPath,\n STRAPI_ADMIN_BACKEND_URL: sameOrigin ? serverPublicPath : serverAbsoluteUrl,\n STRAPI_TELEMETRY_DISABLED: String(strapiInstance.telemetry.isDisabled),\n // TODO: Get this url from a utility/consts rather than duplicating it in AIChat constants.ts\n STRAPI_AI_URL:\n process.env.STRAPI_AI_URL?.replace(/\\/+$/, '') ?? 'https://strapi-ai.apps.strapi.io',\n STRAPI_ANALYTICS_URL: process.env.STRAPI_ANALYTICS_URL || 'https://analytics.strapi.io',\n });\n\n // NOTE: Transports `admin.auth.cookie.name` / `path` / `domain` into the bundle; always\n // assigned so ambient STRAPI_ADMIN_AUTH_COOKIE_* env vars cannot make the bundle disagree\n // with the server. Domain falls back to `admin.auth.domain`, matching the server resolution.\n env.STRAPI_ADMIN_AUTH_COOKIE_NAME =\n strapiInstance.config.get<string | undefined>('admin.auth.cookie.name') || '';\n env.STRAPI_ADMIN_AUTH_COOKIE_PATH =\n strapiInstance.config.get<string | undefined>('admin.auth.cookie.path') || '';\n env.STRAPI_ADMIN_AUTH_COOKIE_DOMAIN =\n strapiInstance.config.get<string | undefined>('admin.auth.cookie.domain') ||\n strapiInstance.config.get<string | undefined>('admin.auth.domain') ||\n '';\n\n const envKeys = Object.keys(env);\n\n if (envKeys.length > 0) {\n logger.debug(\n [\n 'Including the following ENV variables as part of the JS bundle:',\n ...envKeys.map((key) => ` - ${key}`),\n ].join(os.EOL)\n );\n }\n\n const distPath = path.join(strapiInstance.dirs.dist.root, 'build');\n const distDir = path.relative(cwd, distPath);\n\n /**\n * If the distPath already exists, clean it\n */\n try {\n logger.debug(`Cleaning dist folder: ${distPath}`);\n await fs.rm(distPath, { recursive: true, force: true });\n logger.debug('Cleaned dist folder');\n } catch {\n // do nothing, it will fail if the folder does not exist\n logger.debug('There was no dist folder to clean');\n }\n\n const runtimeDir = path.join(cwd, '.strapi', 'client');\n const entry = path.relative(cwd, path.join(runtimeDir, 'app.js'));\n\n const plugins = await getEnabledPlugins({ cwd, logger, runtimeDir, strapi: strapiInstance });\n\n logger.debug('Enabled plugins', os.EOL, plugins);\n\n const pluginsWithFront = getMapOfPluginsWithAdmin(plugins);\n\n logger.debug('Enabled plugins with FE', os.EOL, pluginsWithFront);\n\n const target = browserslist.loadConfig({ path: cwd }) ?? DEFAULT_BROWSERSLIST;\n\n const customisations = await loadUserAppFile({ appDir, runtimeDir });\n\n const features = strapiInstance.config.get('features', undefined);\n\n const { bundler = 'vite', ...restOptions } = options;\n\n const buildContext: BuildContext = {\n appDir,\n adminPath,\n basePath: adminPublicPath,\n bundler,\n customisations,\n cwd,\n distDir,\n distPath,\n entry,\n env,\n features,\n logger,\n options: restOptions,\n plugins: pluginsWithFront,\n runtimeDir,\n strapi: strapiInstance,\n target,\n tsconfig,\n };\n\n return buildContext;\n};\n\nexport { createBuildContext };\nexport type { BuildContext, CreateBuildContextArgs };\n"],"names":["DEFAULT_BROWSERSLIST","createBuildContext","cwd","logger","tsconfig","strapi","options","strapiInstance","createStrapi","appDir","distDir","config","outDir","autoReload","serveAdminPanel","serverAbsoluteUrl","get","adminAbsoluteUrl","adminPath","sameOrigin","URL","origin","adminPublicPath","pathname","serverPublicPath","dirs","app","root","loadEnv","env","getStrapiAdminEnvVars","ADMIN_PATH","STRAPI_ADMIN_BACKEND_URL","STRAPI_TELEMETRY_DISABLED","String","telemetry","isDisabled","STRAPI_AI_URL","process","replace","STRAPI_ANALYTICS_URL","STRAPI_ADMIN_AUTH_COOKIE_NAME","STRAPI_ADMIN_AUTH_COOKIE_PATH","STRAPI_ADMIN_AUTH_COOKIE_DOMAIN","envKeys","Object","keys","length","debug","map","key","join","os","EOL","distPath","path","dist","relative","fs","rm","recursive","force","runtimeDir","entry","plugins","getEnabledPlugins","pluginsWithFront","getMapOfPluginsWithAdmin","target","browserslist","loadConfig","customisations","loadUserAppFile","features","undefined","bundler","restOptions","buildContext","basePath"],"mappings":";;;;;;;;;;;;;;;;;;AA+CA,MAAMA,oBAAAA,GAAuB;AAC3B,IAAA,uBAAA;AACA,IAAA,aAAA;AACA,IAAA,uBAAA;AACA,IAAA;AACD,CAAA;AAED,MAAMC,kBAAAA,GAAqB,OAAO,EAChCC,GAAG,EACHC,MAAM,EACNC,QAAQ,EACRC,MAAM,EACNC,OAAAA,GAAU,EAAE,EACW,GAAA;AACvB;;;;MAKA,MAAMC,cAAAA,GACJF,MAAAA,IACAG,iBAAAA,CAAa;;QAEXC,MAAAA,EAAQP,GAAAA;QACRQ,OAAAA,EAASN,QAAAA,EAAUO,MAAAA,CAAOL,OAAAA,CAAQM,MAAAA,IAAU,EAAA;;QAE5CC,UAAAA,EAAY,IAAA;QACZC,eAAAA,EAAiB;AACnB,KAAA,CAAA;AAEF,IAAA,MAAMC,iBAAAA,GAAoBR,cAAAA,CAAeI,MAAM,CAACK,GAAG,CAAS,oBAAA,CAAA;AAC5D,IAAA,MAAMC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A,QAAAA;AACAtE,QAAAA,MAAAA;QACAG,OAAAA,EAASsE,WAAAA;QACTZ,OAAAA,EAASE,gBAAAA;AACTJ,QAAAA,UAAAA;QACAzD,MAAAA,EAAQE,cAAAA;AACR6D,QAAAA,MAAAA;AACAhE,QAAAA;AACF,KAAA;IAEA,OAAOyE,YAAAA;AACT;;;;"}
1
+ {"version":3,"file":"create-build-context.js","sources":["../../../src/node/create-build-context.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs/promises';\nimport browserslist from 'browserslist';\nimport { createStrapi } from '@strapi/core';\nimport type { Core, Modules } from '@strapi/types';\n\nimport type { CLIContext } from '../cli/types';\nimport { getStrapiAdminEnvVars, loadEnv } from './core/env';\n\nimport { PluginMeta, getEnabledPlugins, getMapOfPluginsWithAdmin } from './core/plugins';\nimport { AppFile, loadUserAppFile } from './core/admin-customisations';\nimport { getScanRoots } from './core/scan-roots';\nimport { getModulePath } from './core/resolve-module';\nimport type { BaseContext } from './types';\n\ninterface BaseOptions {\n stats?: boolean;\n minify?: boolean;\n sourcemap?: boolean;\n bundler?: 'webpack' | 'vite';\n open?: boolean;\n}\n\ninterface BuildContext extends BaseContext {\n /**\n * The customisations defined by the user in their app.js file\n */\n customisations?: AppFile;\n /**\n * Features object with future flags\n */\n features?: Modules.Features.FeaturesService['config'];\n /**\n * The build options\n */\n options: BaseOptions;\n /**\n * The plugins to be included in the JS bundle\n * incl. internal plugins, third party plugins & local plugins\n */\n plugins: PluginMeta[];\n /**\n * True when the `unstableNextDesignSystem` future flag is on and the bundler is Vite. The single\n * decision point for the Tailwind plugin, the host stylesheet and the scan roots\n */\n nextDesignSystem: boolean;\n /** The directories Tailwind scans. Computed once: the stylesheet, Vite and the watcher share it */\n scanRoots: string[];\n}\n\ninterface CreateBuildContextArgs extends CLIContext {\n strapi?: Core.Strapi;\n options?: BaseOptions;\n /** If true, Tailwind scans source and not `dist`. E.g. for Vite development server, which serves `admin/src` */\n dev?: boolean;\n}\n\nconst NEXT_DESIGN_SYSTEM_FLAG = 'unstableNextDesignSystem';\n\n/** The export the flag-on stylesheet imports. Only a design system release with the `next` entry has it */\nconst NEXT_DESIGN_SYSTEM_ENTRY = '@strapi/design-system/next/source.css';\n\n/** Fails the build when @strapi/admin's closure has no next design system entry, the root the Vite alias resolves from */\nconst assertNextDesignSystemEntry = (): void => {\n try {\n getModulePath(NEXT_DESIGN_SYSTEM_ENTRY);\n } catch {\n throw new Error(\n [\n `The ${NEXT_DESIGN_SYSTEM_FLAG} future flag needs a @strapi/design-system release that ships the \"next\" entry, but ${NEXT_DESIGN_SYSTEM_ENTRY} does not resolve.`,\n 'Point the application package.json at such a release:',\n '',\n '\"resolutions\": { \"@strapi/design-system\": \"<version>\" }',\n '',\n 'npm and pnpm users use \"overrides\" in place of \"resolutions\", with the key at the top level of the object.',\n 'An entry in \"dependencies\" is not enough. The override must be global, so that @strapi/admin gets the same copy.',\n 'The current release is the alpha dist-tag on npm, see `npm view @strapi/design-system dist-tags`.',\n ].join(os.EOL)\n );\n }\n};\n\nconst DEFAULT_BROWSERSLIST = [\n 'last 3 major versions',\n 'Firefox ESR',\n 'last 2 Opera versions',\n 'not dead',\n];\n\nconst createBuildContext = async ({\n cwd,\n logger,\n tsconfig,\n strapi,\n options = {},\n dev = false,\n}: CreateBuildContextArgs): Promise<BuildContext> => {\n /**\n * If you make a new strapi instance when one already exists,\n * you will overwrite the global and the app will _most likely_\n * crash and die.\n */\n const strapiInstance =\n strapi ??\n createStrapi({\n // Directories\n appDir: cwd,\n distDir: tsconfig?.config.options.outDir ?? '',\n // Options\n autoReload: true,\n serveAdminPanel: false,\n });\n\n const serverAbsoluteUrl = strapiInstance.config.get<string>('server.absoluteUrl');\n const adminAbsoluteUrl = strapiInstance.config.get<string>('admin.absoluteUrl');\n const adminPath = strapiInstance.config.get<string>('admin.path');\n\n // NOTE: Checks that both the server and admin will be served from the same origin (protocol, host, port)\n const sameOrigin = new URL(adminAbsoluteUrl).origin === new URL(serverAbsoluteUrl).origin;\n\n const adminPublicPath = new URL(adminAbsoluteUrl).pathname;\n const serverPublicPath = new URL(serverAbsoluteUrl).pathname;\n\n const appDir = strapiInstance.dirs.app.root;\n\n await loadEnv(cwd);\n\n const env = getStrapiAdminEnvVars({\n ADMIN_PATH: adminPublicPath,\n STRAPI_ADMIN_BACKEND_URL: sameOrigin ? serverPublicPath : serverAbsoluteUrl,\n STRAPI_TELEMETRY_DISABLED: String(strapiInstance.telemetry.isDisabled),\n // TODO: Get this url from a utility/consts rather than duplicating it in AIChat constants.ts\n STRAPI_AI_URL:\n process.env.STRAPI_AI_URL?.replace(/\\/+$/, '') ?? 'https://strapi-ai.apps.strapi.io',\n STRAPI_ANALYTICS_URL: process.env.STRAPI_ANALYTICS_URL || 'https://analytics.strapi.io',\n });\n\n // NOTE: Transports `admin.auth.cookie.name` / `path` / `domain` into the bundle; always\n // assigned so ambient STRAPI_ADMIN_AUTH_COOKIE_* env vars cannot make the bundle disagree\n // with the server. Domain falls back to `admin.auth.domain`, matching the server resolution.\n env.STRAPI_ADMIN_AUTH_COOKIE_NAME =\n strapiInstance.config.get<string | undefined>('admin.auth.cookie.name') || '';\n env.STRAPI_ADMIN_AUTH_COOKIE_PATH =\n strapiInstance.config.get<string | undefined>('admin.auth.cookie.path') || '';\n env.STRAPI_ADMIN_AUTH_COOKIE_DOMAIN =\n strapiInstance.config.get<string | undefined>('admin.auth.cookie.domain') ||\n strapiInstance.config.get<string | undefined>('admin.auth.domain') ||\n '';\n\n const envKeys = Object.keys(env);\n\n if (envKeys.length > 0) {\n logger.debug(\n [\n 'Including the following ENV variables as part of the JS bundle:',\n ...envKeys.map((key) => ` - ${key}`),\n ].join(os.EOL)\n );\n }\n\n const distPath = path.join(strapiInstance.dirs.dist.root, 'build');\n const distDir = path.relative(cwd, distPath);\n\n /**\n * If the distPath already exists, clean it\n */\n try {\n logger.debug(`Cleaning dist folder: ${distPath}`);\n await fs.rm(distPath, { recursive: true, force: true });\n logger.debug('Cleaned dist folder');\n } catch {\n // do nothing, it will fail if the folder does not exist\n logger.debug('There was no dist folder to clean');\n }\n\n const runtimeDir = path.join(cwd, '.strapi', 'client');\n const entry = path.relative(cwd, path.join(runtimeDir, 'app.js'));\n\n const plugins = await getEnabledPlugins({ cwd, logger, runtimeDir, strapi: strapiInstance });\n\n logger.debug('Enabled plugins', os.EOL, plugins);\n\n const pluginsWithFront = getMapOfPluginsWithAdmin(plugins);\n\n logger.debug('Enabled plugins with FE', os.EOL, pluginsWithFront);\n\n const target = browserslist.loadConfig({ path: cwd }) ?? DEFAULT_BROWSERSLIST;\n\n const customisations = await loadUserAppFile({ appDir, runtimeDir });\n\n const features = strapiInstance.config.get('features', undefined);\n\n const { bundler = 'vite', ...restOptions } = options;\n\n const flagEnabled = strapiInstance.features.future.isEnabled(NEXT_DESIGN_SYSTEM_FLAG);\n\n if (flagEnabled && bundler !== 'vite') {\n logger.warn(\n `The ${NEXT_DESIGN_SYSTEM_FLAG} future flag needs Vite. Tailwind is not available under ${bundler}, so this build has no next design system`\n );\n }\n\n const nextDesignSystem = flagEnabled && bundler === 'vite';\n\n if (nextDesignSystem) {\n assertNextDesignSystemEntry();\n }\n\n const scanRoots = nextDesignSystem\n ? await getScanRoots({ cwd, runtimeDir, plugins: pluginsWithFront, customisations }, dev)\n : [];\n\n if (nextDesignSystem) {\n logger.debug('Tailwind scan roots', os.EOL, scanRoots);\n }\n\n const buildContext: BuildContext = {\n appDir,\n adminPath,\n basePath: adminPublicPath,\n bundler,\n customisations,\n cwd,\n distDir,\n distPath,\n entry,\n env,\n features,\n logger,\n nextDesignSystem,\n options: restOptions,\n plugins: pluginsWithFront,\n runtimeDir,\n scanRoots,\n strapi: strapiInstance,\n target,\n tsconfig,\n };\n\n return buildContext;\n};\n\nexport { createBuildContext };\nexport type { BuildContext, CreateBuildContextArgs };\n"],"names":["NEXT_DESIGN_SYSTEM_FLAG","NEXT_DESIGN_SYSTEM_ENTRY","assertNextDesignSystemEntry","getModulePath","Error","join","os","EOL","DEFAULT_BROWSERSLIST","createBuildContext","cwd","logger","tsconfig","strapi","options","dev","strapiInstance","createStrapi","appDir","distDir","config","outDir","autoReload","serveAdminPanel","serverAbsoluteUrl","get","adminAbsoluteUrl","adminPath","sameOrigin","URL","origin","adminPublicPath","pathname","serverPublicPath","dirs","app","root","loadEnv","env","getStrapiAdminEnvVars","ADMIN_PATH","STRAPI_ADMIN_BACKEND_URL","STRAPI_TELEMETRY_DISABLED","String","telemetry","isDisabled","STRAPI_AI_URL","process","replace","STRAPI_ANALYTICS_URL","STRAPI_ADMIN_AUTH_COOKIE_NAME","STRAPI_ADMIN_AUTH_COOKIE_PATH","STRAPI_ADMIN_AUTH_COOKIE_DOMAIN","envKeys","Object","keys","length","debug","map","key","distPath","path","dist","relative","fs","rm","recursive","force","runtimeDir","entry","plugins","getEnabledPlugins","pluginsWithFront","getMapOfPluginsWithAdmin","target","browserslist","loadConfig","customisations","loadUserAppFile","features","undefined","bundler","restOptions","flagEnabled","future","isEnabled","warn","nextDesignSystem","scanRoots","getScanRoots","buildContext","basePath"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0DA,MAAMA,uBAAAA,GAA0B,0BAAA;AAEhC,4GACA,MAAMC,wBAAAA,GAA2B,uCAAA;AAEjC,2HACA,MAAMC,2BAAAA,GAA8B,IAAA;IAClC,IAAI;QACFC,2BAAAA,CAAcF,wBAAAA,CAAAA;AAChB,IAAA,CAAA,CAAE,OAAM;AACN,QAAA,MAAM,IAAIG,KAAAA,CACR;AACE,YAAA,CAAC,IAAI,EAAEJ,uBAAAA,CAAwB,oFAAoF,EAAEC,wBAAAA,CAAyB,kBAAkB,CAAC;AACjK,YAAA,uDAAA;AACA,YAAA,EAAA;AACA,YAAA,yDAAA;AACA,YAAA,EAAA;AACA,YAAA,4GAAA;AACA,YAAA,kHAAA;AACA,YAAA;SACD,CAACI,IAAI,CAACC,mBAAAA,CAAGC,GAAG,CAAA,CAAA;AAEjB,IAAA;AACF,C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A;AACAnE,QAAAA,GAAAA;AACAS,QAAAA,OAAAA;AACAyC,QAAAA,QAAAA;AACAS,QAAAA,KAAAA;AACA/B,aAAAA,KAAAA;AACAyC,QAAAA,QAAAA;AACApE,QAAAA,MAAAA;AACA4E,QAAAA,gBAAAA;QACAzE,OAAAA,EAASoE,WAAAA;QACTZ,OAAAA,EAASE,gBAAAA;AACTJ,QAAAA,UAAAA;AACAoB,mBAAAA,WAAAA;QACA3E,MAAAA,EAAQG,cAAAA;AACR0D,QAAAA,MAAAA;AACA9D,QAAAA;AACF,KAAA;IAEA,OAAO8E,YAAAA;AACT;;;;"}
@@ -6,14 +6,34 @@ import { createStrapi } from '@strapi/core';
6
6
  import { loadEnv, getStrapiAdminEnvVars } from './core/env.mjs';
7
7
  import { getEnabledPlugins, getMapOfPluginsWithAdmin } from './core/plugins.mjs';
8
8
  import { loadUserAppFile } from './core/admin-customisations.mjs';
9
+ import { getScanRoots } from './core/scan-roots.mjs';
10
+ import { getModulePath } from './core/resolve-module.mjs';
9
11
 
12
+ const NEXT_DESIGN_SYSTEM_FLAG = 'unstableNextDesignSystem';
13
+ /** The export the flag-on stylesheet imports. Only a design system release with the `next` entry has it */ const NEXT_DESIGN_SYSTEM_ENTRY = '@strapi/design-system/next/source.css';
14
+ /** Fails the build when @strapi/admin's closure has no next design system entry, the root the Vite alias resolves from */ const assertNextDesignSystemEntry = ()=>{
15
+ try {
16
+ getModulePath(NEXT_DESIGN_SYSTEM_ENTRY);
17
+ } catch {
18
+ throw new Error([
19
+ `The ${NEXT_DESIGN_SYSTEM_FLAG} future flag needs a @strapi/design-system release that ships the "next" entry, but ${NEXT_DESIGN_SYSTEM_ENTRY} does not resolve.`,
20
+ 'Point the application package.json at such a release:',
21
+ '',
22
+ '"resolutions": { "@strapi/design-system": "<version>" }',
23
+ '',
24
+ 'npm and pnpm users use "overrides" in place of "resolutions", with the key at the top level of the object.',
25
+ 'An entry in "dependencies" is not enough. The override must be global, so that @strapi/admin gets the same copy.',
26
+ 'The current release is the alpha dist-tag on npm, see `npm view @strapi/design-system dist-tags`.'
27
+ ].join(os.EOL));
28
+ }
29
+ };
10
30
  const DEFAULT_BROWSERSLIST = [
11
31
  'last 3 major versions',
12
32
  'Firefox ESR',
13
33
  'last 2 Opera versions',
14
34
  'not dead'
15
35
  ];
16
- const createBuildContext = async ({ cwd, logger, tsconfig, strapi, options = {} })=>{
36
+ const createBuildContext = async ({ cwd, logger, tsconfig, strapi, options = {}, dev = false })=>{
17
37
  /**
18
38
  * If you make a new strapi instance when one already exists,
19
39
  * you will overwrite the global and the app will _most likely_
@@ -91,6 +111,23 @@ const createBuildContext = async ({ cwd, logger, tsconfig, strapi, options = {}
91
111
  });
92
112
  const features = strapiInstance.config.get('features', undefined);
93
113
  const { bundler = 'vite', ...restOptions } = options;
114
+ const flagEnabled = strapiInstance.features.future.isEnabled(NEXT_DESIGN_SYSTEM_FLAG);
115
+ if (flagEnabled && bundler !== 'vite') {
116
+ logger.warn(`The ${NEXT_DESIGN_SYSTEM_FLAG} future flag needs Vite. Tailwind is not available under ${bundler}, so this build has no next design system`);
117
+ }
118
+ const nextDesignSystem = flagEnabled && bundler === 'vite';
119
+ if (nextDesignSystem) {
120
+ assertNextDesignSystemEntry();
121
+ }
122
+ const scanRoots = nextDesignSystem ? await getScanRoots({
123
+ cwd,
124
+ runtimeDir,
125
+ plugins: pluginsWithFront,
126
+ customisations
127
+ }, dev) : [];
128
+ if (nextDesignSystem) {
129
+ logger.debug('Tailwind scan roots', os.EOL, scanRoots);
130
+ }
94
131
  const buildContext = {
95
132
  appDir,
96
133
  adminPath,
@@ -104,9 +141,11 @@ const createBuildContext = async ({ cwd, logger, tsconfig, strapi, options = {}
104
141
  env,
105
142
  features,
106
143
  logger,
144
+ nextDesignSystem,
107
145
  options: restOptions,
108
146
  plugins: pluginsWithFront,
109
147
  runtimeDir,
148
+ scanRoots,
110
149
  strapi: strapiInstance,
111
150
  target,
112
151
  tsconfig
@@ -1 +1 @@
1
- {"version":3,"file":"create-build-context.mjs","sources":["../../../src/node/create-build-context.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs/promises';\nimport browserslist from 'browserslist';\nimport { createStrapi } from '@strapi/core';\nimport type { Core, Modules } from '@strapi/types';\n\nimport type { CLIContext } from '../cli/types';\nimport { getStrapiAdminEnvVars, loadEnv } from './core/env';\n\nimport { PluginMeta, getEnabledPlugins, getMapOfPluginsWithAdmin } from './core/plugins';\nimport { AppFile, loadUserAppFile } from './core/admin-customisations';\nimport type { BaseContext } from './types';\n\ninterface BaseOptions {\n stats?: boolean;\n minify?: boolean;\n sourcemap?: boolean;\n bundler?: 'webpack' | 'vite';\n open?: boolean;\n}\n\ninterface BuildContext extends BaseContext {\n /**\n * The customisations defined by the user in their app.js file\n */\n customisations?: AppFile;\n /**\n * Features object with future flags\n */\n features?: Modules.Features.FeaturesService['config'];\n /**\n * The build options\n */\n options: BaseOptions;\n /**\n * The plugins to be included in the JS bundle\n * incl. internal plugins, third party plugins & local plugins\n */\n plugins: PluginMeta[];\n}\n\ninterface CreateBuildContextArgs extends CLIContext {\n strapi?: Core.Strapi;\n options?: BaseOptions;\n}\n\nconst DEFAULT_BROWSERSLIST = [\n 'last 3 major versions',\n 'Firefox ESR',\n 'last 2 Opera versions',\n 'not dead',\n];\n\nconst createBuildContext = async ({\n cwd,\n logger,\n tsconfig,\n strapi,\n options = {},\n}: CreateBuildContextArgs): Promise<BuildContext> => {\n /**\n * If you make a new strapi instance when one already exists,\n * you will overwrite the global and the app will _most likely_\n * crash and die.\n */\n const strapiInstance =\n strapi ??\n createStrapi({\n // Directories\n appDir: cwd,\n distDir: tsconfig?.config.options.outDir ?? '',\n // Options\n autoReload: true,\n serveAdminPanel: false,\n });\n\n const serverAbsoluteUrl = strapiInstance.config.get<string>('server.absoluteUrl');\n const adminAbsoluteUrl = strapiInstance.config.get<string>('admin.absoluteUrl');\n const adminPath = strapiInstance.config.get<string>('admin.path');\n\n // NOTE: Checks that both the server and admin will be served from the same origin (protocol, host, port)\n const sameOrigin = new URL(adminAbsoluteUrl).origin === new URL(serverAbsoluteUrl).origin;\n\n const adminPublicPath = new URL(adminAbsoluteUrl).pathname;\n const serverPublicPath = new URL(serverAbsoluteUrl).pathname;\n\n const appDir = strapiInstance.dirs.app.root;\n\n await loadEnv(cwd);\n\n const env = getStrapiAdminEnvVars({\n ADMIN_PATH: adminPublicPath,\n STRAPI_ADMIN_BACKEND_URL: sameOrigin ? serverPublicPath : serverAbsoluteUrl,\n STRAPI_TELEMETRY_DISABLED: String(strapiInstance.telemetry.isDisabled),\n // TODO: Get this url from a utility/consts rather than duplicating it in AIChat constants.ts\n STRAPI_AI_URL:\n process.env.STRAPI_AI_URL?.replace(/\\/+$/, '') ?? 'https://strapi-ai.apps.strapi.io',\n STRAPI_ANALYTICS_URL: process.env.STRAPI_ANALYTICS_URL || 'https://analytics.strapi.io',\n });\n\n // NOTE: Transports `admin.auth.cookie.name` / `path` / `domain` into the bundle; always\n // assigned so ambient STRAPI_ADMIN_AUTH_COOKIE_* env vars cannot make the bundle disagree\n // with the server. Domain falls back to `admin.auth.domain`, matching the server resolution.\n env.STRAPI_ADMIN_AUTH_COOKIE_NAME =\n strapiInstance.config.get<string | undefined>('admin.auth.cookie.name') || '';\n env.STRAPI_ADMIN_AUTH_COOKIE_PATH =\n strapiInstance.config.get<string | undefined>('admin.auth.cookie.path') || '';\n env.STRAPI_ADMIN_AUTH_COOKIE_DOMAIN =\n strapiInstance.config.get<string | undefined>('admin.auth.cookie.domain') ||\n strapiInstance.config.get<string | undefined>('admin.auth.domain') ||\n '';\n\n const envKeys = Object.keys(env);\n\n if (envKeys.length > 0) {\n logger.debug(\n [\n 'Including the following ENV variables as part of the JS bundle:',\n ...envKeys.map((key) => ` - ${key}`),\n ].join(os.EOL)\n );\n }\n\n const distPath = path.join(strapiInstance.dirs.dist.root, 'build');\n const distDir = path.relative(cwd, distPath);\n\n /**\n * If the distPath already exists, clean it\n */\n try {\n logger.debug(`Cleaning dist folder: ${distPath}`);\n await fs.rm(distPath, { recursive: true, force: true });\n logger.debug('Cleaned dist folder');\n } catch {\n // do nothing, it will fail if the folder does not exist\n logger.debug('There was no dist folder to clean');\n }\n\n const runtimeDir = path.join(cwd, '.strapi', 'client');\n const entry = path.relative(cwd, path.join(runtimeDir, 'app.js'));\n\n const plugins = await getEnabledPlugins({ cwd, logger, runtimeDir, strapi: strapiInstance });\n\n logger.debug('Enabled plugins', os.EOL, plugins);\n\n const pluginsWithFront = getMapOfPluginsWithAdmin(plugins);\n\n logger.debug('Enabled plugins with FE', os.EOL, pluginsWithFront);\n\n const target = browserslist.loadConfig({ path: cwd }) ?? DEFAULT_BROWSERSLIST;\n\n const customisations = await loadUserAppFile({ appDir, runtimeDir });\n\n const features = strapiInstance.config.get('features', undefined);\n\n const { bundler = 'vite', ...restOptions } = options;\n\n const buildContext: BuildContext = {\n appDir,\n adminPath,\n basePath: adminPublicPath,\n bundler,\n customisations,\n cwd,\n distDir,\n distPath,\n entry,\n env,\n features,\n logger,\n options: restOptions,\n plugins: pluginsWithFront,\n runtimeDir,\n strapi: strapiInstance,\n target,\n tsconfig,\n };\n\n return buildContext;\n};\n\nexport { createBuildContext };\nexport type { BuildContext, CreateBuildContextArgs };\n"],"names":["DEFAULT_BROWSERSLIST","createBuildContext","cwd","logger","tsconfig","strapi","options","strapiInstance","createStrapi","appDir","distDir","config","outDir","autoReload","serveAdminPanel","serverAbsoluteUrl","get","adminAbsoluteUrl","adminPath","sameOrigin","URL","origin","adminPublicPath","pathname","serverPublicPath","dirs","app","root","loadEnv","env","getStrapiAdminEnvVars","ADMIN_PATH","STRAPI_ADMIN_BACKEND_URL","STRAPI_TELEMETRY_DISABLED","String","telemetry","isDisabled","STRAPI_AI_URL","process","replace","STRAPI_ANALYTICS_URL","STRAPI_ADMIN_AUTH_COOKIE_NAME","STRAPI_ADMIN_AUTH_COOKIE_PATH","STRAPI_ADMIN_AUTH_COOKIE_DOMAIN","envKeys","Object","keys","length","debug","map","key","join","os","EOL","distPath","path","dist","relative","fs","rm","recursive","force","runtimeDir","entry","plugins","getEnabledPlugins","pluginsWithFront","getMapOfPluginsWithAdmin","target","browserslist","loadConfig","customisations","loadUserAppFile","features","undefined","bundler","restOptions","buildContext","basePath"],"mappings":";;;;;;;;;AA+CA,MAAMA,oBAAAA,GAAuB;AAC3B,IAAA,uBAAA;AACA,IAAA,aAAA;AACA,IAAA,uBAAA;AACA,IAAA;AACD,CAAA;AAED,MAAMC,kBAAAA,GAAqB,OAAO,EAChCC,GAAG,EACHC,MAAM,EACNC,QAAQ,EACRC,MAAM,EACNC,OAAAA,GAAU,EAAE,EACW,GAAA;AACvB;;;;MAKA,MAAMC,cAAAA,GACJF,MAAAA,IACAG,YAAAA,CAAa;;QAEXC,MAAAA,EAAQP,GAAAA;QACRQ,OAAAA,EAASN,QAAAA,EAAUO,MAAAA,CAAOL,OAAAA,CAAQM,MAAAA,IAAU,EAAA;;QAE5CC,UAAAA,EAAY,IAAA;QACZC,eAAAA,EAAiB;AACnB,KAAA,CAAA;AAEF,IAAA,MAAMC,iBAAAA,GAAoBR,cAAAA,CAAeI,MAAM,CAACK,GAAG,CAAS,oBAAA,CAAA;AAC5D,IAAA,MAAMC,gBAAAA,GAAmBV,cAAAA,CAAeI,MAAM,CAACK,GAAG,CAAS,mBAAA,CAAA;AAC3D,IAAA,MAAME,SAAAA,GAAYX,cAAAA,CAAeI,MAAM,CAACK,GAAG,CAAS,YAAA,CAAA;;IAGpD,MAAMG,UAAAA,GAAa,IAAIC,GAAAA,CAAIH,gBAAAA,CAAAA,CAAkBI,MAAM,KAAK,IAAID,GAAAA,CAAIL,iBAAAA,CAAAA,CAAmBM,MAAM;AAEzF,IAAA,MAAMC,eAAAA,GAAkB,IAAIF,GAAAA,CAAIH,gBAAAA,CAAAA,CAAkBM,QAAQ;AAC1D,IAAA,MAAMC,gBAAAA,GAAmB,IAAIJ,GAAAA,CAAIL,iBAAAA,CAAAA,CA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A;AAElD7D,IAAAA,MAAAA,CAAO6C,KAAK,CAAC,yBAAA,EAA2BI,EAAAA,CAAGC,GAAG,EAAEa,gBAAAA,CAAAA;IAEhD,MAAME,MAAAA,GAASC,YAAAA,CAAaC,UAAU,CAAC;QAAEf,IAAAA,EAAMrD;KAAI,CAAA,IAAMF,oBAAAA;IAEzD,MAAMuE,cAAAA,GAAiB,MAAMC,eAAAA,CAAgB;AAAE/D,QAAAA,MAAAA;AAAQqD,QAAAA;AAAW,KAAA,CAAA;AAElE,IAAA,MAAMW,WAAWlE,cAAAA,CAAeI,MAAM,CAACK,GAAG,CAAC,UAAA,EAAY0D,SAAAA,CAAAA;AAEvD,IAAA,MAAM,EAAEC,OAAAA,GAAU,MAAM,EAAE,GAAGC,aAAa,GAAGtE,OAAAA;AAE7C,IAAA,MAAMuE,YAAAA,GAA6B;AACjCpE,QAAAA,MAAAA;AACAS,QAAAA,SAAAA;QACA4D,QAAAA,EAAUxD,eAAAA;AACVqD,QAAAA,OAAAA;AACAJ,QAAAA,cAAAA;AACArE,QAAAA,GAAAA;AACAQ,QAAAA,OAAAA;AACA4C,QAAAA,QAAAA;AACAS,QAAAA,KAAAA;AACAlC,QAAAA,GAAAA;AACA4C,QAAAA,QAAAA;AACAtE,QAAAA,MAAAA;QACAG,OAAAA,EAASsE,WAAAA;QACTZ,OAAAA,EAASE,gBAAAA;AACTJ,QAAAA,UAAAA;QACAzD,MAAAA,EAAQE,cAAAA;AACR6D,QAAAA,MAAAA;AACAhE,QAAAA;AACF,KAAA;IAEA,OAAOyE,YAAAA;AACT;;;;"}
1
+ {"version":3,"file":"create-build-context.mjs","sources":["../../../src/node/create-build-context.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs/promises';\nimport browserslist from 'browserslist';\nimport { createStrapi } from '@strapi/core';\nimport type { Core, Modules } from '@strapi/types';\n\nimport type { CLIContext } from '../cli/types';\nimport { getStrapiAdminEnvVars, loadEnv } from './core/env';\n\nimport { PluginMeta, getEnabledPlugins, getMapOfPluginsWithAdmin } from './core/plugins';\nimport { AppFile, loadUserAppFile } from './core/admin-customisations';\nimport { getScanRoots } from './core/scan-roots';\nimport { getModulePath } from './core/resolve-module';\nimport type { BaseContext } from './types';\n\ninterface BaseOptions {\n stats?: boolean;\n minify?: boolean;\n sourcemap?: boolean;\n bundler?: 'webpack' | 'vite';\n open?: boolean;\n}\n\ninterface BuildContext extends BaseContext {\n /**\n * The customisations defined by the user in their app.js file\n */\n customisations?: AppFile;\n /**\n * Features object with future flags\n */\n features?: Modules.Features.FeaturesService['config'];\n /**\n * The build options\n */\n options: BaseOptions;\n /**\n * The plugins to be included in the JS bundle\n * incl. internal plugins, third party plugins & local plugins\n */\n plugins: PluginMeta[];\n /**\n * True when the `unstableNextDesignSystem` future flag is on and the bundler is Vite. The single\n * decision point for the Tailwind plugin, the host stylesheet and the scan roots\n */\n nextDesignSystem: boolean;\n /** The directories Tailwind scans. Computed once: the stylesheet, Vite and the watcher share it */\n scanRoots: string[];\n}\n\ninterface CreateBuildContextArgs extends CLIContext {\n strapi?: Core.Strapi;\n options?: BaseOptions;\n /** If true, Tailwind scans source and not `dist`. E.g. for Vite development server, which serves `admin/src` */\n dev?: boolean;\n}\n\nconst NEXT_DESIGN_SYSTEM_FLAG = 'unstableNextDesignSystem';\n\n/** The export the flag-on stylesheet imports. Only a design system release with the `next` entry has it */\nconst NEXT_DESIGN_SYSTEM_ENTRY = '@strapi/design-system/next/source.css';\n\n/** Fails the build when @strapi/admin's closure has no next design system entry, the root the Vite alias resolves from */\nconst assertNextDesignSystemEntry = (): void => {\n try {\n getModulePath(NEXT_DESIGN_SYSTEM_ENTRY);\n } catch {\n throw new Error(\n [\n `The ${NEXT_DESIGN_SYSTEM_FLAG} future flag needs a @strapi/design-system release that ships the \"next\" entry, but ${NEXT_DESIGN_SYSTEM_ENTRY} does not resolve.`,\n 'Point the application package.json at such a release:',\n '',\n '\"resolutions\": { \"@strapi/design-system\": \"<version>\" }',\n '',\n 'npm and pnpm users use \"overrides\" in place of \"resolutions\", with the key at the top level of the object.',\n 'An entry in \"dependencies\" is not enough. The override must be global, so that @strapi/admin gets the same copy.',\n 'The current release is the alpha dist-tag on npm, see `npm view @strapi/design-system dist-tags`.',\n ].join(os.EOL)\n );\n }\n};\n\nconst DEFAULT_BROWSERSLIST = [\n 'last 3 major versions',\n 'Firefox ESR',\n 'last 2 Opera versions',\n 'not dead',\n];\n\nconst createBuildContext = async ({\n cwd,\n logger,\n tsconfig,\n strapi,\n options = {},\n dev = false,\n}: CreateBuildContextArgs): Promise<BuildContext> => {\n /**\n * If you make a new strapi instance when one already exists,\n * you will overwrite the global and the app will _most likely_\n * crash and die.\n */\n const strapiInstance =\n strapi ??\n createStrapi({\n // Directories\n appDir: cwd,\n distDir: tsconfig?.config.options.outDir ?? '',\n // Options\n autoReload: true,\n serveAdminPanel: false,\n });\n\n const serverAbsoluteUrl = strapiInstance.config.get<string>('server.absoluteUrl');\n const adminAbsoluteUrl = strapiInstance.config.get<string>('admin.absoluteUrl');\n const adminPath = strapiInstance.config.get<string>('admin.path');\n\n // NOTE: Checks that both the server and admin will be served from the same origin (protocol, host, port)\n const sameOrigin = new URL(adminAbsoluteUrl).origin === new URL(serverAbsoluteUrl).origin;\n\n const adminPublicPath = new URL(adminAbsoluteUrl).pathname;\n const serverPublicPath = new URL(serverAbsoluteUrl).pathname;\n\n const appDir = strapiInstance.dirs.app.root;\n\n await loadEnv(cwd);\n\n const env = getStrapiAdminEnvVars({\n ADMIN_PATH: adminPublicPath,\n STRAPI_ADMIN_BACKEND_URL: sameOrigin ? serverPublicPath : serverAbsoluteUrl,\n STRAPI_TELEMETRY_DISABLED: String(strapiInstance.telemetry.isDisabled),\n // TODO: Get this url from a utility/consts rather than duplicating it in AIChat constants.ts\n STRAPI_AI_URL:\n process.env.STRAPI_AI_URL?.replace(/\\/+$/, '') ?? 'https://strapi-ai.apps.strapi.io',\n STRAPI_ANALYTICS_URL: process.env.STRAPI_ANALYTICS_URL || 'https://analytics.strapi.io',\n });\n\n // NOTE: Transports `admin.auth.cookie.name` / `path` / `domain` into the bundle; always\n // assigned so ambient STRAPI_ADMIN_AUTH_COOKIE_* env vars cannot make the bundle disagree\n // with the server. Domain falls back to `admin.auth.domain`, matching the server resolution.\n env.STRAPI_ADMIN_AUTH_COOKIE_NAME =\n strapiInstance.config.get<string | undefined>('admin.auth.cookie.name') || '';\n env.STRAPI_ADMIN_AUTH_COOKIE_PATH =\n strapiInstance.config.get<string | undefined>('admin.auth.cookie.path') || '';\n env.STRAPI_ADMIN_AUTH_COOKIE_DOMAIN =\n strapiInstance.config.get<string | undefined>('admin.auth.cookie.domain') ||\n strapiInstance.config.get<string | undefined>('admin.auth.domain') ||\n '';\n\n const envKeys = Object.keys(env);\n\n if (envKeys.length > 0) {\n logger.debug(\n [\n 'Including the following ENV variables as part of the JS bundle:',\n ...envKeys.map((key) => ` - ${key}`),\n ].join(os.EOL)\n );\n }\n\n const distPath = path.join(strapiInstance.dirs.dist.root, 'build');\n const distDir = path.relative(cwd, distPath);\n\n /**\n * If the distPath already exists, clean it\n */\n try {\n logger.debug(`Cleaning dist folder: ${distPath}`);\n await fs.rm(distPath, { recursive: true, force: true });\n logger.debug('Cleaned dist folder');\n } catch {\n // do nothing, it will fail if the folder does not exist\n logger.debug('There was no dist folder to clean');\n }\n\n const runtimeDir = path.join(cwd, '.strapi', 'client');\n const entry = path.relative(cwd, path.join(runtimeDir, 'app.js'));\n\n const plugins = await getEnabledPlugins({ cwd, logger, runtimeDir, strapi: strapiInstance });\n\n logger.debug('Enabled plugins', os.EOL, plugins);\n\n const pluginsWithFront = getMapOfPluginsWithAdmin(plugins);\n\n logger.debug('Enabled plugins with FE', os.EOL, pluginsWithFront);\n\n const target = browserslist.loadConfig({ path: cwd }) ?? DEFAULT_BROWSERSLIST;\n\n const customisations = await loadUserAppFile({ appDir, runtimeDir });\n\n const features = strapiInstance.config.get('features', undefined);\n\n const { bundler = 'vite', ...restOptions } = options;\n\n const flagEnabled = strapiInstance.features.future.isEnabled(NEXT_DESIGN_SYSTEM_FLAG);\n\n if (flagEnabled && bundler !== 'vite') {\n logger.warn(\n `The ${NEXT_DESIGN_SYSTEM_FLAG} future flag needs Vite. Tailwind is not available under ${bundler}, so this build has no next design system`\n );\n }\n\n const nextDesignSystem = flagEnabled && bundler === 'vite';\n\n if (nextDesignSystem) {\n assertNextDesignSystemEntry();\n }\n\n const scanRoots = nextDesignSystem\n ? await getScanRoots({ cwd, runtimeDir, plugins: pluginsWithFront, customisations }, dev)\n : [];\n\n if (nextDesignSystem) {\n logger.debug('Tailwind scan roots', os.EOL, scanRoots);\n }\n\n const buildContext: BuildContext = {\n appDir,\n adminPath,\n basePath: adminPublicPath,\n bundler,\n customisations,\n cwd,\n distDir,\n distPath,\n entry,\n env,\n features,\n logger,\n nextDesignSystem,\n options: restOptions,\n plugins: pluginsWithFront,\n runtimeDir,\n scanRoots,\n strapi: strapiInstance,\n target,\n tsconfig,\n };\n\n return buildContext;\n};\n\nexport { createBuildContext };\nexport type { BuildContext, CreateBuildContextArgs };\n"],"names":["NEXT_DESIGN_SYSTEM_FLAG","NEXT_DESIGN_SYSTEM_ENTRY","assertNextDesignSystemEntry","getModulePath","Error","join","os","EOL","DEFAULT_BROWSERSLIST","createBuildContext","cwd","logger","tsconfig","strapi","options","dev","strapiInstance","createStrapi","appDir","distDir","config","outDir","autoReload","serveAdminPanel","serverAbsoluteUrl","get","adminAbsoluteUrl","adminPath","sameOrigin","URL","origin","adminPublicPath","pathname","serverPublicPath","dirs","app","root","loadEnv","env","getStrapiAdminEnvVars","ADMIN_PATH","STRAPI_ADMIN_BACKEND_URL","STRAPI_TELEMETRY_DISABLED","String","telemetry","isDisabled","STRAPI_AI_URL","process","replace","STRAPI_ANALYTICS_URL","STRAPI_ADMIN_AUTH_COOKIE_NAME","STRAPI_ADMIN_AUTH_COOKIE_PATH","STRAPI_ADMIN_AUTH_COOKIE_DOMAIN","envKeys","Object","keys","length","debug","map","key","distPath","path","dist","relative","fs","rm","recursive","force","runtimeDir","entry","plugins","getEnabledPlugins","pluginsWithFront","getMapOfPluginsWithAdmin","target","browserslist","loadConfig","customisations","loadUserAppFile","features","undefined","bundler","restOptions","flagEnabled","future","isEnabled","warn","nextDesignSystem","scanRoots","getScanRoots","buildContext","basePath"],"mappings":";;;;;;;;;;;AA0DA,MAAMA,uBAAAA,GAA0B,0BAAA;AAEhC,4GACA,MAAMC,wBAAAA,GAA2B,uCAAA;AAEjC,2HACA,MAAMC,2BAAAA,GAA8B,IAAA;IAClC,IAAI;QACFC,aAAAA,CAAcF,wBAAAA,CAAAA;AAChB,IAAA,CAAA,CAAE,OAAM;AACN,QAAA,MAAM,IAAIG,KAAAA,CACR;AACE,YAAA,CAAC,IAAI,EAAEJ,uBAAAA,CAAwB,oFAAoF,EAAEC,wBAAAA,CAAyB,kBAAkB,CAAC;AACjK,YAAA,uDAAA;AACA,YAAA,EAAA;AACA,YAAA,yDAAA;AACA,YAAA,EAAA;AACA,YAAA,4GAAA;AACA,YAAA,kHAAA;AACA,YAAA;SACD,CAACI,IAAI,CAACC,EAAAA,CAAGC,GAAG,CAAA,CAAA;AAEjB,IAAA;AACF,CAAA;AAEA,MAAMC,oBAAAA,GAAuB;AAC3B,IAAA,uBAAA;AACA,IAAA,aAAA;AACA,IAAA,uBAAA;AACA,IAAA;AACD,CAAA;AAED,MAAMC,qBAAqB,OAAO,EAChCC,GAAG,EACHC,MAAM,EACNC,QAAQ,EACRC,MAAM,EACNC,OAAAA,GAAU,EAAE,EACZC,GAAAA,GAAM,KAAK,EACY,GAAA;AACvB;;;;MAKA,MAAMC,cAAAA,GACJH,MAAAA,IACAI,YAAAA,CAAa;;QAEXC,MAAAA,EAAQR,GAAAA;QACRS,OAAAA,EAASP,QAAAA,EAAUQ,MAAAA,CAAON,OAAAA,CAAQO,MAAAA,IAAU,EAAA;;QAE5CC,UAAAA,EAAY,IAAA;QACZC,eAAAA,EAAiB;AACnB,K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,CAAO2E,IAAI,CACT,CAAC,IAAI,EAAEtF,wBAAwB,yDAAyD,EAAEiF,OAAAA,CAAQ,yCAAyC,CAAC,CAAA;AAEhJ,IAAA;IAEA,MAAMM,gBAAAA,GAAmBJ,eAAeF,OAAAA,KAAY,MAAA;AAEpD,IAAA,IAAIM,gBAAAA,EAAkB;AACpBrF,QAAAA,2BAAAA,EAAAA;AACF,IAAA;IAEA,MAAMsF,SAAAA,GAAYD,gBAAAA,GACd,MAAME,YAAAA,CAAa;AAAE/E,QAAAA,GAAAA;AAAK0D,QAAAA,UAAAA;QAAYE,OAAAA,EAASE,gBAAAA;AAAkBK,QAAAA;AAAe,KAAA,EAAG9D,OACnF,EAAE;AAEN,IAAA,IAAIwE,gBAAAA,EAAkB;AACpB5E,QAAAA,MAAAA,CAAO8C,KAAK,CAAC,qBAAA,EAAuBnD,EAAAA,CAAGC,GAAG,EAAEiF,SAAAA,CAAAA;AAC9C,IAAA;AAEA,IAAA,MAAME,YAAAA,GAA6B;AACjCxE,QAAAA,MAAAA;AACAS,QAAAA,SAAAA;QACAgE,QAAAA,EAAU5D,eAAAA;AACVkD,QAAAA,OAAAA;AACAJ,QAAAA,cAAAA;AACAnE,QAAAA,GAAAA;AACAS,QAAAA,OAAAA;AACAyC,QAAAA,QAAAA;AACAS,QAAAA,KAAAA;AACA/B,QAAAA,GAAAA;AACAyC,QAAAA,QAAAA;AACApE,QAAAA,MAAAA;AACA4E,QAAAA,gBAAAA;QACAzE,OAAAA,EAASoE,WAAAA;QACTZ,OAAAA,EAASE,gBAAAA;AACTJ,QAAAA,UAAAA;AACAoB,QAAAA,SAAAA;QACA3E,MAAAA,EAAQG,cAAAA;AACR0D,QAAAA,MAAAA;AACA9D,QAAAA;AACF,KAAA;IAEA,OAAO8E,YAAAA;AACT;;;;"}
@@ -195,7 +195,8 @@ const develop = async ({ cwd, polling, logger, tsconfig, watchAdmin, buildAdmin,
195
195
  logger,
196
196
  strapi,
197
197
  tsconfig,
198
- options
198
+ options,
199
+ dev: true
199
200
  });
200
201
  const contextDuration = timer$1.end('createBuildContext');
201
202
  contextSpinner.text = `Building build context (${timer.prettyTime(contextDuration)})`;
@@ -1 +1 @@
1
- {"version":3,"file":"develop.js","sources":["../../../src/node/develop.ts"],"sourcesContent":["import fs from 'node:fs/promises';\nimport path from 'node:path';\nimport cluster from 'node:cluster';\n\nimport type chokidarType from 'chokidar';\nimport type { createStrapi as CreateStrapi } from '@strapi/core';\nimport type { CLIContext } from '../cli/types';\nimport { handleAdminDependencies } from './core/ensure-admin-dependencies';\nimport { getTimer, prettyTime, type TimeMeasurer } from './core/timer';\nimport type { WebpackWatcher } from './webpack/watch';\nimport type { ViteWatcher } from './vite/watch';\nimport type { Logger } from '../cli/utils/logger';\n\n// Lazy: worker-only deps; primary cluster process should not pay for them\nconst lazy = <T>(spec: string): (() => T) => {\n let cached: T | undefined;\n return (): T => {\n if (cached === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n cached = require(spec);\n }\n return cached as T;\n };\n};\nconst tsUtils = lazy<typeof import('@strapi/typescript-utils')>('@strapi/typescript-utils');\nconst utils = lazy<typeof import('@strapi/utils')>('@strapi/utils');\nconst chokidar = lazy<typeof chokidarType>('chokidar');\nconst core = lazy<typeof import('@strapi/core')>('@strapi/core');\nconst buildCtx = lazy<typeof import('./create-build-context')>('./create-build-context');\nconst staticFs = lazy<typeof import('./staticFiles')>('./staticFiles');\n\ninterface DevelopOptions extends CLIContext {\n /**\n * Which bundler to use for building.\n *\n * @default vite\n */\n bundler?: 'webpack' | 'vite';\n polling?: boolean;\n open?: boolean;\n watchAdmin?: boolean;\n buildAdmin?: boolean;\n /**\n * Auto-install missing admin dependencies\n *\n * @default true\n */\n installDeps?: boolean;\n}\n\n// This method removes all non-admin build files from the dist directory\nconst cleanupDistDirectory = async ({\n tsconfig,\n logger,\n timer,\n}: Pick<DevelopOptions, 'tsconfig' | 'logger'> & { timer: TimeMeasurer }) => {\n const distDir = tsconfig?.config?.options?.outDir;\n\n if (\n !distDir || // we don't have a dist dir\n (await fs\n .access(distDir)\n .then(() => false)\n .catch(() => true)) // it doesn't exist -- if it does but no access, that will be caught later\n ) {\n return;\n }\n\n const timerName = `cleaningDist${Date.now()}`;\n timer.start(timerName);\n const cleaningSpinner = logger.spinner(`Cleaning dist dir ${distDir}`).start();\n\n try {\n const dirContent = await fs.readdir(distDir);\n const validFilenames = dirContent\n // Ignore the admin build folder and the TypeScript incremental cache\n .filter((filename) => filename !== 'build' && !filename.endsWith('.tsbuildinfo'));\n for (const filename of validFilenames) {\n await fs.rm(path.resolve(distDir, filename), { recursive: true });\n }\n } catch (err: unknown) {\n const generatingDuration = timer.end(timerName);\n cleaningSpinner.text = `Error cleaning dist dir: ${err} (${prettyTime(generatingDuration)})`;\n cleaningSpinner?.fail();\n return;\n }\n\n const generatingDuration = timer.end(timerName);\n cleaningSpinner.text = `Cleaning dist dir (${prettyTime(generatingDuration)})`;\n cleaningSpinner?.succeed();\n};\n\nconst develop = async ({\n cwd,\n polling,\n logger,\n tsconfig,\n watchAdmin,\n buildAdmin,\n installDeps = true,\n ...options\n}: DevelopOptions) => {\n const timer = getTimer();\n\n if (cluster.isPrimary) {\n const shouldContinue = await handleAdminDependencies({\n cwd,\n logger,\n installIfMissing: installDeps,\n });\n\n if (!shouldContinue) {\n return;\n }\n\n if (tsconfig?.config) {\n // Build without diagnostics in case schemas have changed\n await cleanupDistDirectory({ tsconfig, logger, timer });\n try {\n await tsUtils().compile(cwd, { configOptions: { ignoreDiagnostics: true } });\n } catch (err: unknown) {\n logger.error(`Error during initial TypeScript compilation: ${(err as Error).message}`);\n // We don't return here because we want to attempt to start the server even if the initial compilation fails, as it can be fixed while the server is running\n }\n }\n\n /**\n * IF we're not watching the admin we're going to build it, this makes\n * sure that at least the admin is built for users & they can interact\n * with the application.\n */\n if (!watchAdmin && buildAdmin) {\n timer.start('createBuildContext');\n const contextSpinner = logger.spinner(`Building build context`).start();\n console.log('');\n\n const ctx = await buildCtx().createBuildContext({\n cwd,\n logger,\n tsconfig,\n options,\n });\n const contextDuration = timer.end('createBuildContext');\n contextSpinner.text = `Building build context (${prettyTime(contextDuration)})`;\n contextSpinner.succeed();\n\n timer.start('creatingAdmin');\n const adminSpinner = logger.spinner(`Creating admin`).start();\n\n await staticFs().writeStaticClientFiles(ctx);\n\n if (ctx.bundler === 'webpack') {\n const { build: buildWebpack } = await import('./webpack/build');\n await buildWebpack(ctx);\n } else if (ctx.bundler === 'vite') {\n const { build: buildVite } = await import('./vite/build');\n await buildVite(ctx);\n }\n\n const adminDuration = timer.end('creatingAdmin');\n adminSpinner.text = `Creating admin (${prettyTime(adminDuration)})`;\n adminSpinner.succeed();\n }\n\n cluster.on('message', async (worker, message) => {\n switch (message) {\n case 'reload': {\n if (tsconfig?.config) {\n try {\n // Build without diagnostics in case schemas have changed\n await cleanupDistDirectory({ tsconfig, logger, timer });\n await tsUtils().compile(cwd, { configOptions: { ignoreDiagnostics: true } });\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n logger.error(`Error during TypeScript compilation on reload: ${message}`);\n process.exit(1);\n }\n }\n logger.debug('cluster has the reload message, sending the worker kill message');\n worker.send('kill');\n break;\n }\n case 'killed': {\n logger.debug('cluster has the killed message, forking the cluster');\n cluster.fork();\n break;\n }\n case 'stop': {\n process.exit(1);\n break;\n }\n default:\n break;\n }\n });\n\n cluster.fork();\n }\n\n if (cluster.isWorker) {\n timer.start('loadStrapi');\n const loadStrapiSpinner = logger.spinner(`Loading Strapi`).start();\n\n const strapi = core().createStrapi({\n appDir: cwd,\n distDir: tsconfig?.config.options.outDir ?? '',\n autoReload: true,\n serveAdminPanel: !watchAdmin,\n });\n\n /**\n * If we're watching the admin panel then we're going to attach the watcher\n * as a strapi middleware.\n */\n let bundleWatcher: WebpackWatcher | ViteWatcher | undefined;\n\n const strapiInstance = await strapi.load();\n\n const contextSpinner = logger.spinner(`Building build context`);\n const adminSpinner = logger.spinner(`Creating admin`);\n const generatingTsSpinner = logger.spinner(`Generating types`);\n const compilingTsSpinner = logger.spinner(`Compiling TS`);\n\n let watcherStarted = false;\n const ensureWatcher = () => {\n if (!watcherStarted) {\n watcherStarted = true;\n startWatcher(strapiInstance, cwd, polling ?? false, logger, bundleWatcher);\n }\n };\n\n try {\n if (watchAdmin) {\n timer.start('createBuildContext');\n contextSpinner.start();\n\n const ctx = await buildCtx().createBuildContext({\n cwd,\n logger,\n strapi,\n tsconfig,\n options,\n });\n const contextDuration = timer.end('createBuildContext');\n contextSpinner.text = `Building build context (${prettyTime(contextDuration)})`;\n contextSpinner.succeed();\n\n timer.start('creatingAdmin');\n adminSpinner.start();\n\n await staticFs().writeStaticClientFiles(ctx);\n\n if (ctx.bundler === 'webpack') {\n const { watch: watchWebpack } = await import('./webpack/watch');\n bundleWatcher = await watchWebpack(ctx);\n } else if (ctx.bundler === 'vite') {\n const { watch: watchVite } = await import('./vite/watch');\n bundleWatcher = await watchVite(ctx);\n }\n\n const adminDuration = timer.end('creatingAdmin');\n adminSpinner.text = `Creating admin (${prettyTime(adminDuration)})`;\n adminSpinner.succeed();\n }\n\n const loadStrapiDuration = timer.end('loadStrapi');\n loadStrapiSpinner.text = `Loading Strapi (${prettyTime(loadStrapiDuration)})`;\n loadStrapiSpinner.succeed();\n\n // For TS projects, type generation is a requirement for the develop command so that the server can restart\n // For JS projects, we respect the experimental autogenerate setting\n if (tsconfig?.config || strapi.config.get('typescript.autogenerate') !== false) {\n timer.start('generatingTS');\n generatingTsSpinner.start();\n\n await tsUtils().generators.generate({\n strapi: strapiInstance,\n pwd: cwd,\n rootDir: undefined,\n logger: { silent: true, debug: false },\n artifacts: { contentTypes: true, components: true },\n });\n\n const generatingDuration = timer.end('generatingTS');\n generatingTsSpinner.text = `Generating types (${prettyTime(generatingDuration)})`;\n generatingTsSpinner.succeed();\n }\n\n if (tsconfig?.config) {\n timer.start('compilingTS');\n compilingTsSpinner.start();\n\n await cleanupDistDirectory({ tsconfig, logger, timer });\n await tsUtils().compile(cwd, { configOptions: { ignoreDiagnostics: false } });\n\n const compilingDuration = timer.end('compilingTS');\n compilingTsSpinner.text = `Compiling TS (${prettyTime(compilingDuration)})`;\n compilingTsSpinner.succeed();\n }\n\n ensureWatcher();\n\n strapiInstance.start();\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n logger.error(`Error during development: ${message}`);\n\n if (loadStrapiSpinner.isSpinning) {\n loadStrapiSpinner.fail();\n }\n // Fail any spinners that were left running.\n if (contextSpinner.isSpinning) {\n contextSpinner.fail();\n }\n if (compilingTsSpinner.isSpinning) {\n compilingTsSpinner.fail();\n }\n if (adminSpinner.isSpinning) {\n adminSpinner.fail();\n }\n if (generatingTsSpinner.isSpinning) {\n generatingTsSpinner.fail();\n }\n\n ensureWatcher();\n }\n }\n};\n\nfunction startWatcher(\n strapiInstance: Awaited<ReturnType<typeof CreateStrapi>>,\n cwd: string,\n polling: boolean,\n logger: Logger,\n bundleWatcher?: WebpackWatcher | ViteWatcher\n) {\n const restart = async () => {\n if (strapiInstance.reload.isWatching && !strapiInstance.reload.isReloading) {\n strapiInstance.reload.isReloading = true;\n strapiInstance.reload();\n }\n };\n\n const watcher = chokidar()\n .watch(cwd, {\n ignoreInitial: true,\n usePolling: polling,\n ignored: [\n /(^|[/\\\\])\\../, // dot files\n /tmp/,\n '**/src/admin/**',\n '**/src/plugins/**/admin/**',\n '**/dist/src/plugins/test/admin/**',\n '**/documentation',\n '**/documentation/**',\n '**/node_modules',\n '**/node_modules/**',\n '**/plugins.json',\n '**/build',\n '**/build/**',\n '**/log',\n '**/log/**',\n '**/logs',\n '**/logs/**',\n '**/*.log',\n '**/index.html',\n '**/public',\n '**/public/**',\n strapiInstance.dirs.static.public,\n utils().strings.joinBy('/', strapiInstance.dirs.static.public, '**'),\n '**/*.db*',\n '**/exports/**',\n '**/dist/**',\n '**/*.d.ts',\n '**/.yalc/**',\n '**/yalc.lock',\n // TODO v6: watch only src folder by default, and flip this to watchIncludeFiles\n ...strapiInstance.config.get('admin.watchIgnoreFiles', []),\n ],\n })\n .on('add', (path) => {\n strapiInstance.log.info(`File created: ${path}`);\n restart();\n })\n .on('change', (path) => {\n strapiInstance.log.info(`File changed: ${path}`);\n restart();\n })\n .on('unlink', (path) => {\n strapiInstance.log.info(`File deleted: ${path}`);\n restart();\n });\n\n process.on('message', async (message) => {\n switch (message) {\n case 'kill': {\n logger.debug(\n 'child process has the kill message, destroying the strapi instance and sending the killed process message'\n );\n await watcher.close();\n\n await strapiInstance.destroy();\n\n if (bundleWatcher) {\n bundleWatcher.close();\n }\n process.send?.('killed');\n break;\n }\n default:\n break;\n }\n });\n}\n\nexport { develop };\nexport type { DevelopOptions };\n"],"names":["lazy","spec","cached","undefined","require","tsUtils","utils","chokidar","core","buildCtx","staticFs","cleanupDistDirectory","tsconfig","logger","timer","distDir","config","options","outDir","fs","access","then","catch","timerName","Date","now","start","cleaningSpinner","spinner","dirContent","readdir","validFilenames","filter","filename","endsWith","rm","path","resolve","recursive","err","generatingDuration","end","text","prettyTime","fail","succeed","develop","cwd","polling","watchAdmin","buildAdmin","installDeps","getTimer","cluster","isPrimary","shouldContinue","handleAdminDependencies","installIfMissing","compile","configOptions","ignoreDiagnostics","error","message","contextSpinner","console","log","ctx","createBuildContext","contextDuration","adminSpinner","writeStaticClientFiles","bundler","build","buildWebpack","buildVite","adminDuration","on","worker","Error","String","process","exit","debug","send","fork","isWorker","loadStrapiSpinner","strapi","createStrapi","appDir","autoReload","serveAdminPanel","bundleWatcher","strapiInstance","load","generatingTsSpinner","compilingTsSpinner","watcherStarted","ensureWatcher","startWatcher","watch","watchWebpack","watchVite","loadStrapiDuration","get","generators","generate","pwd","rootDir","silent","artifacts","contentTypes","components","compilingDuration","isSpinning","restart","reload","isWatching","isReloading","watcher","ignoreInitial","usePolling","ignored","dirs","static","public","strings","joinBy","info","close","destroy"],"mappings":";;;;;;;;;;;;;;AAaA;AACA,MAAMA,OAAO,CAAIC,IAAAA,GAAAA;IACf,IAAIC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AA;AAC/C+E,QAAAA,OAAAA,EAAAA;IACF,CAAA,CAAA,CACCvC,EAAE,CAAC,QAAA,EAAU,CAACxC,IAAAA,GAAAA;AACbyD,QAAAA,cAAAA,CAAe5B,GAAG,CAAC+D,IAAI,CAAC,CAAC,cAAc,EAAE5F,IAAAA,CAAAA,CAAM,CAAA;AAC/C+E,QAAAA,OAAAA,EAAAA;IACF,CAAA,CAAA,CACCvC,EAAE,CAAC,QAAA,EAAU,CAACxC,IAAAA,GAAAA;AACbyD,QAAAA,cAAAA,CAAe5B,GAAG,CAAC+D,IAAI,CAAC,CAAC,cAAc,EAAE5F,IAAAA,CAAAA,CAAM,CAAA;AAC/C+E,QAAAA,OAAAA,EAAAA;AACF,IAAA,CAAA,CAAA;IAEFnC,OAAAA,CAAQJ,EAAE,CAAC,SAAA,EAAW,OAAOd,OAAAA,GAAAA;QAC3B,OAAQA,OAAAA;YACN,KAAK,MAAA;AAAQ,gBAAA;AACXjD,oBAAAA,MAAAA,CAAOqE,KAAK,CACV,2GAAA,CAAA;AAEF,oBAAA,MAAMqC,QAAQU,KAAK,EAAA;AAEnB,oBAAA,MAAMpC,eAAeqC,OAAO,EAAA;AAE5B,oBAAA,IAAItC,aAAAA,EAAe;AACjBA,wBAAAA,aAAAA,CAAcqC,KAAK,EAAA;AACrB,oBAAA;AACAjD,oBAAAA,OAAAA,CAAQG,IAAI,GAAG,QAAA,CAAA;AACf,oBAAA;AACF,gBAAA;AAGF;AACF,IAAA,CAAA,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"develop.js","sources":["../../../src/node/develop.ts"],"sourcesContent":["import fs from 'node:fs/promises';\nimport path from 'node:path';\nimport cluster from 'node:cluster';\n\nimport type chokidarType from 'chokidar';\nimport type { createStrapi as CreateStrapi } from '@strapi/core';\nimport type { CLIContext } from '../cli/types';\nimport { handleAdminDependencies } from './core/ensure-admin-dependencies';\nimport { getTimer, prettyTime, type TimeMeasurer } from './core/timer';\nimport type { WebpackWatcher } from './webpack/watch';\nimport type { ViteWatcher } from './vite/watch';\nimport type { Logger } from '../cli/utils/logger';\n\n// Lazy: worker-only deps; primary cluster process should not pay for them\nconst lazy = <T>(spec: string): (() => T) => {\n let cached: T | undefined;\n return (): T => {\n if (cached === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n cached = require(spec);\n }\n return cached as T;\n };\n};\nconst tsUtils = lazy<typeof import('@strapi/typescript-utils')>('@strapi/typescript-utils');\nconst utils = lazy<typeof import('@strapi/utils')>('@strapi/utils');\nconst chokidar = lazy<typeof chokidarType>('chokidar');\nconst core = lazy<typeof import('@strapi/core')>('@strapi/core');\nconst buildCtx = lazy<typeof import('./create-build-context')>('./create-build-context');\nconst staticFs = lazy<typeof import('./staticFiles')>('./staticFiles');\n\ninterface DevelopOptions extends CLIContext {\n /**\n * Which bundler to use for building.\n *\n * @default vite\n */\n bundler?: 'webpack' | 'vite';\n polling?: boolean;\n open?: boolean;\n watchAdmin?: boolean;\n buildAdmin?: boolean;\n /**\n * Auto-install missing admin dependencies\n *\n * @default true\n */\n installDeps?: boolean;\n}\n\n// This method removes all non-admin build files from the dist directory\nconst cleanupDistDirectory = async ({\n tsconfig,\n logger,\n timer,\n}: Pick<DevelopOptions, 'tsconfig' | 'logger'> & { timer: TimeMeasurer }) => {\n const distDir = tsconfig?.config?.options?.outDir;\n\n if (\n !distDir || // we don't have a dist dir\n (await fs\n .access(distDir)\n .then(() => false)\n .catch(() => true)) // it doesn't exist -- if it does but no access, that will be caught later\n ) {\n return;\n }\n\n const timerName = `cleaningDist${Date.now()}`;\n timer.start(timerName);\n const cleaningSpinner = logger.spinner(`Cleaning dist dir ${distDir}`).start();\n\n try {\n const dirContent = await fs.readdir(distDir);\n const validFilenames = dirContent\n // Ignore the admin build folder and the TypeScript incremental cache\n .filter((filename) => filename !== 'build' && !filename.endsWith('.tsbuildinfo'));\n for (const filename of validFilenames) {\n await fs.rm(path.resolve(distDir, filename), { recursive: true });\n }\n } catch (err: unknown) {\n const generatingDuration = timer.end(timerName);\n cleaningSpinner.text = `Error cleaning dist dir: ${err} (${prettyTime(generatingDuration)})`;\n cleaningSpinner?.fail();\n return;\n }\n\n const generatingDuration = timer.end(timerName);\n cleaningSpinner.text = `Cleaning dist dir (${prettyTime(generatingDuration)})`;\n cleaningSpinner?.succeed();\n};\n\nconst develop = async ({\n cwd,\n polling,\n logger,\n tsconfig,\n watchAdmin,\n buildAdmin,\n installDeps = true,\n ...options\n}: DevelopOptions) => {\n const timer = getTimer();\n\n if (cluster.isPrimary) {\n const shouldContinue = await handleAdminDependencies({\n cwd,\n logger,\n installIfMissing: installDeps,\n });\n\n if (!shouldContinue) {\n return;\n }\n\n if (tsconfig?.config) {\n // Build without diagnostics in case schemas have changed\n await cleanupDistDirectory({ tsconfig, logger, timer });\n try {\n await tsUtils().compile(cwd, { configOptions: { ignoreDiagnostics: true } });\n } catch (err: unknown) {\n logger.error(`Error during initial TypeScript compilation: ${(err as Error).message}`);\n // We don't return here because we want to attempt to start the server even if the initial compilation fails, as it can be fixed while the server is running\n }\n }\n\n /**\n * IF we're not watching the admin we're going to build it, this makes\n * sure that at least the admin is built for users & they can interact\n * with the application.\n */\n if (!watchAdmin && buildAdmin) {\n timer.start('createBuildContext');\n const contextSpinner = logger.spinner(`Building build context`).start();\n console.log('');\n\n const ctx = await buildCtx().createBuildContext({\n cwd,\n logger,\n tsconfig,\n options,\n });\n const contextDuration = timer.end('createBuildContext');\n contextSpinner.text = `Building build context (${prettyTime(contextDuration)})`;\n contextSpinner.succeed();\n\n timer.start('creatingAdmin');\n const adminSpinner = logger.spinner(`Creating admin`).start();\n\n await staticFs().writeStaticClientFiles(ctx);\n\n if (ctx.bundler === 'webpack') {\n const { build: buildWebpack } = await import('./webpack/build');\n await buildWebpack(ctx);\n } else if (ctx.bundler === 'vite') {\n const { build: buildVite } = await import('./vite/build');\n await buildVite(ctx);\n }\n\n const adminDuration = timer.end('creatingAdmin');\n adminSpinner.text = `Creating admin (${prettyTime(adminDuration)})`;\n adminSpinner.succeed();\n }\n\n cluster.on('message', async (worker, message) => {\n switch (message) {\n case 'reload': {\n if (tsconfig?.config) {\n try {\n // Build without diagnostics in case schemas have changed\n await cleanupDistDirectory({ tsconfig, logger, timer });\n await tsUtils().compile(cwd, { configOptions: { ignoreDiagnostics: true } });\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n logger.error(`Error during TypeScript compilation on reload: ${message}`);\n process.exit(1);\n }\n }\n logger.debug('cluster has the reload message, sending the worker kill message');\n worker.send('kill');\n break;\n }\n case 'killed': {\n logger.debug('cluster has the killed message, forking the cluster');\n cluster.fork();\n break;\n }\n case 'stop': {\n process.exit(1);\n break;\n }\n default:\n break;\n }\n });\n\n cluster.fork();\n }\n\n if (cluster.isWorker) {\n timer.start('loadStrapi');\n const loadStrapiSpinner = logger.spinner(`Loading Strapi`).start();\n\n const strapi = core().createStrapi({\n appDir: cwd,\n distDir: tsconfig?.config.options.outDir ?? '',\n autoReload: true,\n serveAdminPanel: !watchAdmin,\n });\n\n /**\n * If we're watching the admin panel then we're going to attach the watcher\n * as a strapi middleware.\n */\n let bundleWatcher: WebpackWatcher | ViteWatcher | undefined;\n\n const strapiInstance = await strapi.load();\n\n const contextSpinner = logger.spinner(`Building build context`);\n const adminSpinner = logger.spinner(`Creating admin`);\n const generatingTsSpinner = logger.spinner(`Generating types`);\n const compilingTsSpinner = logger.spinner(`Compiling TS`);\n\n let watcherStarted = false;\n const ensureWatcher = () => {\n if (!watcherStarted) {\n watcherStarted = true;\n startWatcher(strapiInstance, cwd, polling ?? false, logger, bundleWatcher);\n }\n };\n\n try {\n if (watchAdmin) {\n timer.start('createBuildContext');\n contextSpinner.start();\n\n const ctx = await buildCtx().createBuildContext({\n cwd,\n logger,\n strapi,\n tsconfig,\n options,\n dev: true,\n });\n const contextDuration = timer.end('createBuildContext');\n contextSpinner.text = `Building build context (${prettyTime(contextDuration)})`;\n contextSpinner.succeed();\n\n timer.start('creatingAdmin');\n adminSpinner.start();\n\n await staticFs().writeStaticClientFiles(ctx);\n\n if (ctx.bundler === 'webpack') {\n const { watch: watchWebpack } = await import('./webpack/watch');\n bundleWatcher = await watchWebpack(ctx);\n } else if (ctx.bundler === 'vite') {\n const { watch: watchVite } = await import('./vite/watch');\n bundleWatcher = await watchVite(ctx);\n }\n\n const adminDuration = timer.end('creatingAdmin');\n adminSpinner.text = `Creating admin (${prettyTime(adminDuration)})`;\n adminSpinner.succeed();\n }\n\n const loadStrapiDuration = timer.end('loadStrapi');\n loadStrapiSpinner.text = `Loading Strapi (${prettyTime(loadStrapiDuration)})`;\n loadStrapiSpinner.succeed();\n\n // For TS projects, type generation is a requirement for the develop command so that the server can restart\n // For JS projects, we respect the experimental autogenerate setting\n if (tsconfig?.config || strapi.config.get('typescript.autogenerate') !== false) {\n timer.start('generatingTS');\n generatingTsSpinner.start();\n\n await tsUtils().generators.generate({\n strapi: strapiInstance,\n pwd: cwd,\n rootDir: undefined,\n logger: { silent: true, debug: false },\n artifacts: { contentTypes: true, components: true },\n });\n\n const generatingDuration = timer.end('generatingTS');\n generatingTsSpinner.text = `Generating types (${prettyTime(generatingDuration)})`;\n generatingTsSpinner.succeed();\n }\n\n if (tsconfig?.config) {\n timer.start('compilingTS');\n compilingTsSpinner.start();\n\n await cleanupDistDirectory({ tsconfig, logger, timer });\n await tsUtils().compile(cwd, { configOptions: { ignoreDiagnostics: false } });\n\n const compilingDuration = timer.end('compilingTS');\n compilingTsSpinner.text = `Compiling TS (${prettyTime(compilingDuration)})`;\n compilingTsSpinner.succeed();\n }\n\n ensureWatcher();\n\n strapiInstance.start();\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n logger.error(`Error during development: ${message}`);\n\n if (loadStrapiSpinner.isSpinning) {\n loadStrapiSpinner.fail();\n }\n // Fail any spinners that were left running.\n if (contextSpinner.isSpinning) {\n contextSpinner.fail();\n }\n if (compilingTsSpinner.isSpinning) {\n compilingTsSpinner.fail();\n }\n if (adminSpinner.isSpinning) {\n adminSpinner.fail();\n }\n if (generatingTsSpinner.isSpinning) {\n generatingTsSpinner.fail();\n }\n\n ensureWatcher();\n }\n }\n};\n\nfunction startWatcher(\n strapiInstance: Awaited<ReturnType<typeof CreateStrapi>>,\n cwd: string,\n polling: boolean,\n logger: Logger,\n bundleWatcher?: WebpackWatcher | ViteWatcher\n) {\n const restart = async () => {\n if (strapiInstance.reload.isWatching && !strapiInstance.reload.isReloading) {\n strapiInstance.reload.isReloading = true;\n strapiInstance.reload();\n }\n };\n\n const watcher = chokidar()\n .watch(cwd, {\n ignoreInitial: true,\n usePolling: polling,\n ignored: [\n /(^|[/\\\\])\\../, // dot files\n /tmp/,\n '**/src/admin/**',\n '**/src/plugins/**/admin/**',\n '**/dist/src/plugins/test/admin/**',\n '**/documentation',\n '**/documentation/**',\n '**/node_modules',\n '**/node_modules/**',\n '**/plugins.json',\n '**/build',\n '**/build/**',\n '**/log',\n '**/log/**',\n '**/logs',\n '**/logs/**',\n '**/*.log',\n '**/index.html',\n '**/public',\n '**/public/**',\n strapiInstance.dirs.static.public,\n utils().strings.joinBy('/', strapiInstance.dirs.static.public, '**'),\n '**/*.db*',\n '**/exports/**',\n '**/dist/**',\n '**/*.d.ts',\n '**/.yalc/**',\n '**/yalc.lock',\n // TODO v6: watch only src folder by default, and flip this to watchIncludeFiles\n ...strapiInstance.config.get('admin.watchIgnoreFiles', []),\n ],\n })\n .on('add', (path) => {\n strapiInstance.log.info(`File created: ${path}`);\n restart();\n })\n .on('change', (path) => {\n strapiInstance.log.info(`File changed: ${path}`);\n restart();\n })\n .on('unlink', (path) => {\n strapiInstance.log.info(`File deleted: ${path}`);\n restart();\n });\n\n process.on('message', async (message) => {\n switch (message) {\n case 'kill': {\n logger.debug(\n 'child process has the kill message, destroying the strapi instance and sending the killed process message'\n );\n await watcher.close();\n\n await strapiInstance.destroy();\n\n if (bundleWatcher) {\n bundleWatcher.close();\n }\n process.send?.('killed');\n break;\n }\n default:\n break;\n }\n });\n}\n\nexport { develop };\nexport type { DevelopOptions };\n"],"names":["lazy","spec","cached","undefined","require","tsUtils","utils","chokidar","core","buildCtx","staticFs","cleanupDistDirectory","tsconfig","logger","timer","distDir","config","options","outDir","fs","access","then","catch","timerName","Date","now","start","cleaningSpinner","spinner","dirContent","readdir","validFilenames","filter","filename","endsWith","rm","path","resolve","recursive","err","generatingDuration","end","text","prettyTime","fail","succeed","develop","cwd","polling","watchAdmin","buildAdmin","installDeps","getTimer","cluster","isPrimary","shouldContinue","handleAdminDependencies","installIfMissing","compile","configOptions","ignoreDiagnostics","error","message","contextSpinner","console","log","ctx","createBuildContext","contextDuration","adminSpinner","writeStaticClientFiles","bundler","build","buildWebpack","buildVite","adminDuration","on","worker","Error","String","process","exit","debug","send","fork","isWorker","loadStrapiSpinner","strapi","createStrapi","appDir","autoReload","serveAdminPanel","bundleWatcher","strapiInstance","load","generatingTsSpinner","compilingTsSpinner","watcherStarted","ensureWatcher","startWatcher","dev","watch","watchWebpack","watchVite","loadStrapiDuration","get","generators","generate","pwd","rootDir","silent","artifacts","contentTypes","components","compilingDuration","isSpinning","restart","reload","isWatching","isReloading","watcher","ignoreInitial","usePolling","ignored","dirs","static","public","strings","joinBy","info","close","destroy"],"mappings":";;;;;;;;;;;;;;AAaA;AACA,MAAMA,OAAO,CAAIC,IAAAA,GAAAA;IACf,IAAIC,MAAAA;IACJ,OAAO,IAAA;AACL,QAAA,IAAIA,WAAWC,SAAAA,EAAW;;AAExBD,YAAAA,MAAAA,GAASE,OAAAA,CAAQH,IAAAA,CAAAA;AACnB,QAAA;QACA,OAAOC,MAAAA;AACT,IAAA,CAAA;AACF,CAAA;AACA,MAAMG,UAAUL,IAAAA,CAAgD,0BAAA,CAAA;AAChE,MAAMM,QAAQN,IAAAA,CAAqC,eAAA,CAAA;AACnD,MAAMO,WAAWP,IAAAA,CAA0B,UAAA,CAAA;AAC3C,MAAMQ,OAAOR,IAAAA,CAAoC,cAAA,CAAA;AACjD,MAAMS,WAAWT,IAAAA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AAc,EAAE7F,IAAAA,CAAAA,CAAM,CAAA;AAC/CgF,QAAAA,OAAAA,EAAAA;AACF,IAAA,CAAA,CAAA;IAEFpC,OAAAA,CAAQJ,EAAE,CAAC,SAAA,EAAW,OAAOd,OAAAA,GAAAA;QAC3B,OAAQA,OAAAA;YACN,KAAK,MAAA;AAAQ,gBAAA;AACXjD,oBAAAA,MAAAA,CAAOqE,KAAK,CACV,2GAAA,CAAA;AAEF,oBAAA,MAAMsC,QAAQU,KAAK,EAAA;AAEnB,oBAAA,MAAMrC,eAAesC,OAAO,EAAA;AAE5B,oBAAA,IAAIvC,aAAAA,EAAe;AACjBA,wBAAAA,aAAAA,CAAcsC,KAAK,EAAA;AACrB,oBAAA;AACAlD,oBAAAA,OAAAA,CAAQG,IAAI,GAAG,QAAA,CAAA;AACf,oBAAA;AACF,gBAAA;AAGF;AACF,IAAA,CAAA,CAAA;AACF;;;;"}
@@ -187,7 +187,8 @@ const develop = async ({ cwd, polling, logger, tsconfig, watchAdmin, buildAdmin,
187
187
  logger,
188
188
  strapi,
189
189
  tsconfig,
190
- options
190
+ options,
191
+ dev: true
191
192
  });
192
193
  const contextDuration = timer.end('createBuildContext');
193
194
  contextSpinner.text = `Building build context (${prettyTime(contextDuration)})`;