@strapi/admin 4.15.5-alpha.3 → 4.15.5-alpha.4
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/_chunks/{AuthenticatedApp-79e3f141.js → AuthenticatedApp-31e6418d.js} +21 -21
- package/dist/_chunks/{AuthenticatedApp-79e3f141.js.map → AuthenticatedApp-31e6418d.js.map} +1 -1
- package/dist/_chunks/{AuthenticatedApp-2cfb41e2.mjs → AuthenticatedApp-52d37e32.mjs} +21 -21
- package/dist/_chunks/{AuthenticatedApp-2cfb41e2.mjs.map → AuthenticatedApp-52d37e32.mjs.map} +1 -1
- package/dist/_chunks/{HomePage-a617d19a.js → HomePage-0f953b49.js} +4 -4
- package/dist/_chunks/{HomePage-a617d19a.js.map → HomePage-0f953b49.js.map} +1 -1
- package/dist/_chunks/{HomePage-1376624b.mjs → HomePage-1e7b2e66.mjs} +4 -4
- package/dist/_chunks/{HomePage-1376624b.mjs.map → HomePage-1e7b2e66.mjs.map} +1 -1
- package/dist/_chunks/{HomePage-e333ff90.mjs → HomePage-a2c12504.mjs} +4 -4
- package/dist/_chunks/{HomePage-e333ff90.mjs.map → HomePage-a2c12504.mjs.map} +1 -1
- package/dist/_chunks/{HomePage-a9e9942a.js → HomePage-d0f7fc69.js} +4 -4
- package/dist/_chunks/{HomePage-a9e9942a.js.map → HomePage-d0f7fc69.js.map} +1 -1
- package/dist/_chunks/{InstalledPluginsPage-c7ccd2b2.mjs → InstalledPluginsPage-3fc71003.mjs} +3 -3
- package/dist/_chunks/{InstalledPluginsPage-c7ccd2b2.mjs.map → InstalledPluginsPage-3fc71003.mjs.map} +1 -1
- package/dist/_chunks/{InstalledPluginsPage-fb2aaa1f.js → InstalledPluginsPage-46e14507.js} +3 -3
- package/dist/_chunks/{InstalledPluginsPage-fb2aaa1f.js.map → InstalledPluginsPage-46e14507.js.map} +1 -1
- package/dist/_chunks/{Login-d6fd38ea.js → Login-550366a9.js} +2 -2
- package/dist/_chunks/{Login-d6fd38ea.js.map → Login-550366a9.js.map} +1 -1
- package/dist/_chunks/{Login-69bf063c.mjs → Login-57e0fd9c.mjs} +2 -2
- package/dist/_chunks/{Login-69bf063c.mjs.map → Login-57e0fd9c.mjs.map} +1 -1
- package/dist/_chunks/{MarketplacePage-7c516084.js → MarketplacePage-138e7b39.js} +3 -3
- package/dist/_chunks/{MarketplacePage-7c516084.js.map → MarketplacePage-138e7b39.js.map} +1 -1
- package/dist/_chunks/{MarketplacePage-c829d0de.mjs → MarketplacePage-2505749a.mjs} +3 -3
- package/dist/_chunks/{MarketplacePage-c829d0de.mjs.map → MarketplacePage-2505749a.mjs.map} +1 -1
- package/dist/_chunks/{ProfilePage-a2e54283.js → ProfilePage-23b8a29f.js} +3 -3
- package/dist/_chunks/{ProfilePage-a2e54283.js.map → ProfilePage-23b8a29f.js.map} +1 -1
- package/dist/_chunks/{ProfilePage-c6d8c69f.mjs → ProfilePage-bd50b4f3.mjs} +3 -3
- package/dist/_chunks/{ProfilePage-c6d8c69f.mjs.map → ProfilePage-bd50b4f3.mjs.map} +1 -1
- package/dist/_chunks/{build-20299009.mjs → build-92e15b93.mjs} +13 -13
- package/dist/_chunks/{build-20299009.mjs.map → build-92e15b93.mjs.map} +1 -1
- package/dist/_chunks/{build-58827c7a.js → build-df2f219f.js} +13 -13
- package/dist/_chunks/{build-58827c7a.js.map → build-df2f219f.js.map} +1 -1
- package/dist/_chunks/{constants-a16f9961.js → constants-06897e38.js} +2 -2
- package/dist/_chunks/{constants-a16f9961.js.map → constants-06897e38.js.map} +1 -1
- package/dist/_chunks/{constants-842c6449.mjs → constants-362e760f.mjs} +6 -6
- package/dist/_chunks/{constants-842c6449.mjs.map → constants-362e760f.mjs.map} +1 -1
- package/dist/_chunks/{constants-9212941b.js → constants-4539f7ac.js} +6 -6
- package/dist/_chunks/{constants-9212941b.js.map → constants-4539f7ac.js.map} +1 -1
- package/dist/_chunks/{constants-a3372db6.mjs → constants-59bcff2e.mjs} +3 -3
- package/dist/_chunks/{constants-a3372db6.mjs.map → constants-59bcff2e.mjs.map} +1 -1
- package/dist/_chunks/{constants-fad06b7f.mjs → constants-6dcb43aa.mjs} +2 -2
- package/dist/_chunks/{constants-fad06b7f.mjs.map → constants-6dcb43aa.mjs.map} +1 -1
- package/dist/_chunks/{constants-4c06740e.js → constants-88f9d2a0.js} +3 -3
- package/dist/_chunks/{constants-4c06740e.js.map → constants-88f9d2a0.js.map} +1 -1
- package/dist/_chunks/{constants-962e9922.js → constants-ac7899ed.js} +5 -5
- package/dist/_chunks/{constants-962e9922.js.map → constants-ac7899ed.js.map} +1 -1
- package/dist/_chunks/{constants-5f0670d7.mjs → constants-e2c67ec8.mjs} +5 -5
- package/dist/_chunks/{constants-5f0670d7.mjs.map → constants-e2c67ec8.mjs.map} +1 -1
- package/dist/_chunks/{develop-a7d5cf0c.js → develop-4d25a6e0.js} +13 -13
- package/dist/_chunks/{develop-a7d5cf0c.js.map → develop-4d25a6e0.js.map} +1 -1
- package/dist/_chunks/{develop-7066af5e.mjs → develop-a46fed01.mjs} +13 -13
- package/dist/_chunks/{develop-7066af5e.mjs.map → develop-a46fed01.mjs.map} +1 -1
- package/dist/_chunks/{index-2b331655.js → index-02064a74.js} +3 -3
- package/dist/_chunks/{index-2b331655.js.map → index-02064a74.js.map} +1 -1
- package/dist/_chunks/{index-dede2234.mjs → index-03e8b9e3.mjs} +3 -3
- package/dist/_chunks/{index-dede2234.mjs.map → index-03e8b9e3.mjs.map} +1 -1
- package/dist/_chunks/{index-ea8946fb.js → index-074a5de8.js} +2 -2
- package/dist/_chunks/{index-ea8946fb.js.map → index-074a5de8.js.map} +1 -1
- package/dist/_chunks/{index-c4116296.mjs → index-0778959c.mjs} +6 -6
- package/dist/_chunks/{index-c4116296.mjs.map → index-0778959c.mjs.map} +1 -1
- package/dist/_chunks/{index-e8b17b94.js → index-0b787ac1.js} +5 -5
- package/dist/_chunks/{index-e8b17b94.js.map → index-0b787ac1.js.map} +1 -1
- package/dist/_chunks/{index-3444ab6f.js → index-133699a3.js} +4 -4
- package/dist/_chunks/{index-3444ab6f.js.map → index-133699a3.js.map} +1 -1
- package/dist/_chunks/{index-7d449292.mjs → index-13ab14ec.mjs} +3 -3
- package/dist/_chunks/{index-7d449292.mjs.map → index-13ab14ec.mjs.map} +1 -1
- package/dist/_chunks/{index-d4029932.js → index-148939b0.js} +4 -4
- package/dist/_chunks/{index-d4029932.js.map → index-148939b0.js.map} +1 -1
- package/dist/_chunks/{index-edf62e62.mjs → index-15c76f0b.mjs} +4 -4
- package/dist/_chunks/{index-edf62e62.mjs.map → index-15c76f0b.mjs.map} +1 -1
- package/dist/_chunks/{index-07d155a0.js → index-19b1984d.js} +2 -2
- package/dist/_chunks/{index-07d155a0.js.map → index-19b1984d.js.map} +1 -1
- package/dist/_chunks/{index-cf4fe6b7.mjs → index-1a3e997a.mjs} +8 -8
- package/dist/_chunks/{index-cf4fe6b7.mjs.map → index-1a3e997a.mjs.map} +1 -1
- package/dist/_chunks/{index-b84b9fee.js → index-1a74fa41.js} +348 -302
- package/dist/_chunks/index-1a74fa41.js.map +1 -0
- package/dist/_chunks/{index-ed287ba8.mjs → index-1a7cc203.mjs} +3 -3
- package/dist/_chunks/{index-ed287ba8.mjs.map → index-1a7cc203.mjs.map} +1 -1
- package/dist/_chunks/{index-61c915cd.mjs → index-23925f10.mjs} +2 -2
- package/dist/_chunks/{index-61c915cd.mjs.map → index-23925f10.mjs.map} +1 -1
- package/dist/_chunks/{index-341222f2.js → index-24b626a6.js} +3 -3
- package/dist/_chunks/{index-341222f2.js.map → index-24b626a6.js.map} +1 -1
- package/dist/_chunks/{index-693383db.mjs → index-2b48526d.mjs} +5 -5
- package/dist/_chunks/{index-693383db.mjs.map → index-2b48526d.mjs.map} +1 -1
- package/dist/_chunks/{index-c2b86584.js → index-2c76e5e2.js} +3 -3
- package/dist/_chunks/{index-c2b86584.js.map → index-2c76e5e2.js.map} +1 -1
- package/dist/_chunks/{index-4c29f67c.js → index-36a7c525.js} +3 -3
- package/dist/_chunks/{index-4c29f67c.js.map → index-36a7c525.js.map} +1 -1
- package/dist/_chunks/{index-996f7ad1.mjs → index-3a96c79f.mjs} +3 -3
- package/dist/_chunks/{index-996f7ad1.mjs.map → index-3a96c79f.mjs.map} +1 -1
- package/dist/_chunks/{index-9f88ad83.mjs → index-3be46ca9.mjs} +3 -3
- package/dist/_chunks/{index-9f88ad83.mjs.map → index-3be46ca9.mjs.map} +1 -1
- package/dist/_chunks/{index-45a78b18.mjs → index-4544af4c.mjs} +20 -20
- package/dist/_chunks/{index-45a78b18.mjs.map → index-4544af4c.mjs.map} +1 -1
- package/dist/_chunks/{index-25c9158f.js → index-4b8c01d4.js} +2 -2
- package/dist/_chunks/{index-25c9158f.js.map → index-4b8c01d4.js.map} +1 -1
- package/dist/_chunks/{index-242c514c.mjs → index-4fef292a.mjs} +3 -3
- package/dist/_chunks/{index-242c514c.mjs.map → index-4fef292a.mjs.map} +1 -1
- package/dist/_chunks/{index-adb714e8.mjs → index-5113c6be.mjs} +2 -2
- package/dist/_chunks/{index-adb714e8.mjs.map → index-5113c6be.mjs.map} +1 -1
- package/dist/_chunks/{index-2aed5618.js → index-58ffc071.js} +3 -3
- package/dist/_chunks/{index-2aed5618.js.map → index-58ffc071.js.map} +1 -1
- package/dist/_chunks/{index-517fbe00.mjs → index-59880344.mjs} +5 -5
- package/dist/_chunks/{index-517fbe00.mjs.map → index-59880344.mjs.map} +1 -1
- package/dist/_chunks/{index-68ae52b6.js → index-5c19f439.js} +5 -5
- package/dist/_chunks/{index-68ae52b6.js.map → index-5c19f439.js.map} +1 -1
- package/dist/_chunks/{index-b53ba38d.mjs → index-610889c4.mjs} +4 -4
- package/dist/_chunks/{index-b53ba38d.mjs.map → index-610889c4.mjs.map} +1 -1
- package/dist/_chunks/{index-4a241498.js → index-628c5937.js} +8 -8
- package/dist/_chunks/{index-4a241498.js.map → index-628c5937.js.map} +1 -1
- package/dist/_chunks/{index-f088fe2c.js → index-64a156de.js} +3 -3
- package/dist/_chunks/{index-f088fe2c.js.map → index-64a156de.js.map} +1 -1
- package/dist/_chunks/{index-7a1a0c5c.mjs → index-67a35378.mjs} +3 -3
- package/dist/_chunks/{index-7a1a0c5c.mjs.map → index-67a35378.mjs.map} +1 -1
- package/dist/_chunks/{index-174cc6b9.js → index-6b1148f6.js} +4 -4
- package/dist/_chunks/{index-174cc6b9.js.map → index-6b1148f6.js.map} +1 -1
- package/dist/_chunks/{index-ecb3cfba.js → index-6db2b431.js} +5 -5
- package/dist/_chunks/{index-ecb3cfba.js.map → index-6db2b431.js.map} +1 -1
- package/dist/_chunks/{index-dcd31235.js → index-6e44aef9.js} +3 -3
- package/dist/_chunks/{index-dcd31235.js.map → index-6e44aef9.js.map} +1 -1
- package/dist/_chunks/{index-9b3107a4.mjs → index-70189e76.mjs} +3 -3
- package/dist/_chunks/{index-9b3107a4.mjs.map → index-70189e76.mjs.map} +1 -1
- package/dist/_chunks/{index-563a992a.js → index-86172b2d.js} +4 -4
- package/dist/_chunks/{index-563a992a.js.map → index-86172b2d.js.map} +1 -1
- package/dist/_chunks/{index-35fc9959.js → index-898ba1c6.js} +3 -3
- package/dist/_chunks/{index-35fc9959.js.map → index-898ba1c6.js.map} +1 -1
- package/dist/_chunks/{index-dfc0437b.mjs → index-8bca9e4c.mjs} +4 -4
- package/dist/_chunks/{index-dfc0437b.mjs.map → index-8bca9e4c.mjs.map} +1 -1
- package/dist/_chunks/{index-12b7d75f.js → index-8cafda81.js} +4 -4
- package/dist/_chunks/{index-12b7d75f.js.map → index-8cafda81.js.map} +1 -1
- package/dist/_chunks/{index-48ebb88c.js → index-9195720c.js} +5 -5
- package/dist/_chunks/{index-48ebb88c.js.map → index-9195720c.js.map} +1 -1
- package/dist/_chunks/{index-dcbab202.mjs → index-91ef29b3.mjs} +3 -3
- package/dist/_chunks/{index-dcbab202.mjs.map → index-91ef29b3.mjs.map} +1 -1
- package/dist/_chunks/{index-5b44cba5.mjs → index-994d2c5d.mjs} +2 -2
- package/dist/_chunks/{index-5b44cba5.mjs.map → index-994d2c5d.mjs.map} +1 -1
- package/dist/_chunks/{index-66177bc5.js → index-9deb8ccb.js} +4 -4
- package/dist/_chunks/{index-66177bc5.js.map → index-9deb8ccb.js.map} +1 -1
- package/dist/_chunks/{index-9e5d59f5.mjs → index-9eb4c34d.mjs} +5 -5
- package/dist/_chunks/{index-9e5d59f5.mjs.map → index-9eb4c34d.mjs.map} +1 -1
- package/dist/_chunks/{index-80574f48.mjs → index-9f8605e5.mjs} +3 -3
- package/dist/_chunks/{index-80574f48.mjs.map → index-9f8605e5.mjs.map} +1 -1
- package/dist/_chunks/{index-9d03d359.js → index-a0af8beb.js} +3 -3
- package/dist/_chunks/{index-9d03d359.js.map → index-a0af8beb.js.map} +1 -1
- package/dist/_chunks/{index-314f72f4.mjs → index-aceb13c1.mjs} +4 -4
- package/dist/_chunks/{index-314f72f4.mjs.map → index-aceb13c1.mjs.map} +1 -1
- package/dist/_chunks/{index-c3469f69.js → index-aee95cda.js} +3 -3
- package/dist/_chunks/{index-c3469f69.js.map → index-aee95cda.js.map} +1 -1
- package/dist/_chunks/{index-9910aa5a.mjs → index-b17c7874.mjs} +3 -3
- package/dist/_chunks/{index-9910aa5a.mjs.map → index-b17c7874.mjs.map} +1 -1
- package/dist/_chunks/{index-f097ccea.mjs → index-bb22dbbc.mjs} +3 -3
- package/dist/_chunks/{index-f097ccea.mjs.map → index-bb22dbbc.mjs.map} +1 -1
- package/dist/_chunks/{index-fc7a00f0.js → index-be02d51c.js} +20 -20
- package/dist/_chunks/{index-fc7a00f0.js.map → index-be02d51c.js.map} +1 -1
- package/dist/_chunks/{index-252284ed.js → index-be8eb534.js} +3 -3
- package/dist/_chunks/{index-252284ed.js.map → index-be8eb534.js.map} +1 -1
- package/dist/_chunks/{index-18fed2cd.js → index-c36d6802.js} +3 -3
- package/dist/_chunks/{index-18fed2cd.js.map → index-c36d6802.js.map} +1 -1
- package/dist/_chunks/{index-1316edb2.mjs → index-c45d5f19.mjs} +4 -4
- package/dist/_chunks/{index-1316edb2.mjs.map → index-c45d5f19.mjs.map} +1 -1
- package/dist/_chunks/{index-6b7dceb1.mjs → index-c59a117e.mjs} +3 -3
- package/dist/_chunks/{index-6b7dceb1.mjs.map → index-c59a117e.mjs.map} +1 -1
- package/dist/_chunks/{index-df70cfd7.mjs → index-c9e68296.mjs} +5 -5
- package/dist/_chunks/{index-df70cfd7.mjs.map → index-c9e68296.mjs.map} +1 -1
- package/dist/_chunks/{index-25bb4a4d.js → index-cd6b99a8.js} +5 -5
- package/dist/_chunks/{index-25bb4a4d.js.map → index-cd6b99a8.js.map} +1 -1
- package/dist/_chunks/{index-bef99193.mjs → index-ce41b6f0.mjs} +4 -4
- package/dist/_chunks/{index-bef99193.mjs.map → index-ce41b6f0.mjs.map} +1 -1
- package/dist/_chunks/{index-25feef65.js → index-d3dea80c.js} +6 -6
- package/dist/_chunks/{index-25feef65.js.map → index-d3dea80c.js.map} +1 -1
- package/dist/_chunks/{index-ef0c2ffb.js → index-d63b0b91.js} +4 -4
- package/dist/_chunks/{index-ef0c2ffb.js.map → index-d63b0b91.js.map} +1 -1
- package/dist/_chunks/{index-1e3a2719.mjs → index-dc4938ad.mjs} +5 -5
- package/dist/_chunks/{index-1e3a2719.mjs.map → index-dc4938ad.mjs.map} +1 -1
- package/dist/_chunks/{index-b53cf07d.mjs → index-dc89c18c.mjs} +340 -294
- package/dist/_chunks/index-dc89c18c.mjs.map +1 -0
- package/dist/_chunks/{index-61e392e8.mjs → index-ea43b165.mjs} +5 -5
- package/dist/_chunks/{index-61e392e8.mjs.map → index-ea43b165.mjs.map} +1 -1
- package/dist/_chunks/{index-fbe9dba1.js → index-eb59cabf.js} +3 -3
- package/dist/_chunks/{index-fbe9dba1.js.map → index-eb59cabf.js.map} +1 -1
- package/dist/_chunks/{index-703c58c8.mjs → index-fae4b277.mjs} +4 -4
- package/dist/_chunks/{index-703c58c8.mjs.map → index-fae4b277.mjs.map} +1 -1
- package/dist/_chunks/{index-7338912f.js → index-ff9d30ef.js} +5 -5
- package/dist/_chunks/{index-7338912f.js.map → index-ff9d30ef.js.map} +1 -1
- package/dist/_chunks/{schema-1808aa2d.mjs → schema-549f8236.mjs} +2 -2
- package/dist/_chunks/{schema-1808aa2d.mjs.map → schema-549f8236.mjs.map} +1 -1
- package/dist/_chunks/{schema-e73a6250.js → schema-e3080441.js} +2 -2
- package/dist/_chunks/{schema-e73a6250.js.map → schema-e3080441.js.map} +1 -1
- package/dist/_chunks/{validateWorkflow-1ec1040b.mjs → validateWorkflow-7bff41ac.mjs} +3 -3
- package/dist/_chunks/{validateWorkflow-1ec1040b.mjs.map → validateWorkflow-7bff41ac.mjs.map} +1 -1
- package/dist/_chunks/{validateWorkflow-11ecf8ee.js → validateWorkflow-a7311af1.js} +3 -3
- package/dist/_chunks/{validateWorkflow-11ecf8ee.js.map → validateWorkflow-a7311af1.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/cli.js +12 -12
- package/dist/cli.mjs +12 -12
- package/package.json +12 -12
- package/dist/_chunks/index-b53cf07d.mjs.map +0 -1
- package/dist/_chunks/index-b84b9fee.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import EE from "@strapi/strapi/dist/utils/ee";
|
|
1
2
|
import * as tsUtils from "@strapi/typescript-utils";
|
|
2
3
|
import os from "node:os";
|
|
3
4
|
import fs, { access } from "node:fs/promises";
|
|
@@ -7,6 +8,16 @@ import semver from "semver";
|
|
|
7
8
|
import resolveFrom from "resolve-from";
|
|
8
9
|
import execa from "execa";
|
|
9
10
|
import readPkgUp from "read-pkg-up";
|
|
11
|
+
import { performance } from "perf_hooks";
|
|
12
|
+
import browserslist from "browserslist";
|
|
13
|
+
import strapiFactory from "@strapi/strapi";
|
|
14
|
+
import { env, getConfigUrls, joinBy } from "@strapi/utils";
|
|
15
|
+
import dotenv from "dotenv";
|
|
16
|
+
import { register } from "esbuild-register/dist/node";
|
|
17
|
+
import fs$1 from "node:fs";
|
|
18
|
+
import camelCase from "lodash/camelCase";
|
|
19
|
+
import boxen from "boxen";
|
|
20
|
+
import chalk from "chalk";
|
|
10
21
|
import outdent from "outdent";
|
|
11
22
|
import { format } from "prettier";
|
|
12
23
|
import { createElement } from "react";
|
|
@@ -23,17 +34,6 @@ import crypto from "node:crypto";
|
|
|
23
34
|
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
|
|
24
35
|
import path$1 from "path";
|
|
25
36
|
import findRoot from "find-root";
|
|
26
|
-
import { register } from "esbuild-register/dist/node";
|
|
27
|
-
import boxen from "boxen";
|
|
28
|
-
import chalk from "chalk";
|
|
29
|
-
import browserslist from "browserslist";
|
|
30
|
-
import strapiFactory from "@strapi/strapi";
|
|
31
|
-
import { env, getConfigUrls, joinBy } from "@strapi/utils";
|
|
32
|
-
import dotenv from "dotenv";
|
|
33
|
-
import fs$1 from "node:fs";
|
|
34
|
-
import camelCase from "lodash/camelCase";
|
|
35
|
-
import EE from "@strapi/strapi/dist/utils/ee";
|
|
36
|
-
import { performance } from "perf_hooks";
|
|
37
37
|
import chokidar from "chokidar";
|
|
38
38
|
import cluster from "node:cluster";
|
|
39
39
|
import { promisify } from "node:util";
|
|
@@ -41,7 +41,7 @@ import webpackDevMiddleware from "webpack-dev-middleware";
|
|
|
41
41
|
import webpackHotMiddleware from "webpack-hot-middleware";
|
|
42
42
|
const build$2 = ({ command, ctx }) => {
|
|
43
43
|
command.command("build").option("-d, --debug", "Enable debugging mode with verbose logs", false).option("--ignore-prompts", "Ignore all prompts", false).option("--minify", "Minify the output", true).option("--no-optimization", "[deprecated]: use minify instead").option("--silent", "Don't log anything", false).option("--sourcemap", "Produce sourcemaps", false).option("--stats", "Print build statistics to the console", false).description("Build the strapi admin app").action(async (options) => {
|
|
44
|
-
const { build: build2 } = await import("./build-
|
|
44
|
+
const { build: build2 } = await import("./build-92e15b93.mjs");
|
|
45
45
|
return build2({ ...options, ...ctx });
|
|
46
46
|
});
|
|
47
47
|
};
|
|
@@ -53,7 +53,7 @@ const develop$1 = ({ command, ctx }) => {
|
|
|
53
53
|
"--watch-admin",
|
|
54
54
|
"[deprecated]: there is now middleware for watching, it is no longer a separate process"
|
|
55
55
|
).option("--browser <name>", "[deprecated]: use open instead").option("--open", "Open the admin in your browser", true).description("Start your Strapi application in development mode").action(async (options) => {
|
|
56
|
-
const { develop: develop2 } = await import("./develop-
|
|
56
|
+
const { develop: develop2 } = await import("./develop-a46fed01.mjs");
|
|
57
57
|
return develop2({ ...options, ...ctx });
|
|
58
58
|
});
|
|
59
59
|
};
|
|
@@ -227,6 +227,265 @@ const installDependencies = async (install, { cwd, logger }) => {
|
|
|
227
227
|
throw new Error("Package installation failed");
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
|
+
function getTimer() {
|
|
231
|
+
const timings = {};
|
|
232
|
+
const startTimes = {};
|
|
233
|
+
function start(name) {
|
|
234
|
+
if (typeof startTimes[name] !== "undefined") {
|
|
235
|
+
throw new Error(`Timer "${name}" already started, cannot overwrite`);
|
|
236
|
+
}
|
|
237
|
+
startTimes[name] = performance.now();
|
|
238
|
+
}
|
|
239
|
+
function end(name) {
|
|
240
|
+
if (typeof startTimes[name] === "undefined") {
|
|
241
|
+
throw new Error(`Timer "${name}" never started, cannot end`);
|
|
242
|
+
}
|
|
243
|
+
timings[name] = performance.now() - startTimes[name];
|
|
244
|
+
return timings[name];
|
|
245
|
+
}
|
|
246
|
+
return { start, end, getTimings: () => timings };
|
|
247
|
+
}
|
|
248
|
+
const prettyTime = (timeInMs) => {
|
|
249
|
+
return Math.ceil(timeInMs) + "ms";
|
|
250
|
+
};
|
|
251
|
+
const pathExists = async (path2) => {
|
|
252
|
+
try {
|
|
253
|
+
await access(path2);
|
|
254
|
+
return true;
|
|
255
|
+
} catch (error) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
const loadFile = async (path2) => {
|
|
260
|
+
if (await pathExists(path2)) {
|
|
261
|
+
const esbuildOptions = {
|
|
262
|
+
extensions: [".js", ".mjs", ".ts"]
|
|
263
|
+
};
|
|
264
|
+
const { unregister } = register(esbuildOptions);
|
|
265
|
+
const mod = require(path2);
|
|
266
|
+
unregister();
|
|
267
|
+
const file = mod?.default || mod || void 0;
|
|
268
|
+
return file;
|
|
269
|
+
}
|
|
270
|
+
return void 0;
|
|
271
|
+
};
|
|
272
|
+
const convertSystemPathToModulePath = (sysPath) => {
|
|
273
|
+
if (process.platform === "win32") {
|
|
274
|
+
return sysPath.split(path.sep).join(path.posix.sep);
|
|
275
|
+
} else {
|
|
276
|
+
return sysPath;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
const convertModulePathToSystemPath = (modulePath) => {
|
|
280
|
+
if (process.platform === "win32") {
|
|
281
|
+
return modulePath.split(path.posix.sep).join(path.sep);
|
|
282
|
+
} else {
|
|
283
|
+
return modulePath;
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
const loadEnv = async (cwd) => {
|
|
287
|
+
const pathToEnv = path.resolve(cwd, ".env");
|
|
288
|
+
if (await pathExists(pathToEnv)) {
|
|
289
|
+
dotenv.config({ path: pathToEnv });
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
const getStrapiAdminEnvVars = (defaultEnv) => {
|
|
293
|
+
return Object.keys(process.env).filter((key) => key.toUpperCase().startsWith("STRAPI_ADMIN_")).reduce((acc, key) => {
|
|
294
|
+
acc[key] = process.env[key];
|
|
295
|
+
return acc;
|
|
296
|
+
}, defaultEnv);
|
|
297
|
+
};
|
|
298
|
+
const isError = (err) => err instanceof Error;
|
|
299
|
+
const handleUnexpectedError = (err) => {
|
|
300
|
+
console.error(
|
|
301
|
+
chalk.red(
|
|
302
|
+
`[ERROR] `,
|
|
303
|
+
"There seems to be an unexpected error, try again with --debug for more information",
|
|
304
|
+
os.EOL
|
|
305
|
+
)
|
|
306
|
+
);
|
|
307
|
+
if (isError(err) && err.stack) {
|
|
308
|
+
console.log(
|
|
309
|
+
chalk.red(
|
|
310
|
+
boxen(err.stack, {
|
|
311
|
+
padding: 1,
|
|
312
|
+
align: "left"
|
|
313
|
+
})
|
|
314
|
+
)
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
process.exit(1);
|
|
318
|
+
};
|
|
319
|
+
const validatePackageHasStrapi = (pkg) => "strapi" in pkg && typeof pkg.strapi === "object" && !Array.isArray(pkg.strapi) && pkg.strapi !== null;
|
|
320
|
+
const validatePackageIsPlugin = (pkg) => validatePackageHasStrapi(pkg) && pkg.strapi.kind === "plugin";
|
|
321
|
+
const getEnabledPlugins = async ({
|
|
322
|
+
cwd,
|
|
323
|
+
logger,
|
|
324
|
+
runtimeDir,
|
|
325
|
+
strapi
|
|
326
|
+
}) => {
|
|
327
|
+
const plugins = {};
|
|
328
|
+
const deps = strapi.config.get("info.dependencies", {});
|
|
329
|
+
logger.debug("Dependencies from user's project", os.EOL, deps);
|
|
330
|
+
for (const dep of Object.keys(deps)) {
|
|
331
|
+
const pkg = await getModule(dep, cwd);
|
|
332
|
+
if (pkg && validatePackageIsPlugin(pkg)) {
|
|
333
|
+
const name = pkg.strapi.name || pkg.name;
|
|
334
|
+
if (!name) {
|
|
335
|
+
throw Error(
|
|
336
|
+
"You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!"
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
plugins[name] = {
|
|
340
|
+
name,
|
|
341
|
+
importName: camelCase(name),
|
|
342
|
+
type: "module",
|
|
343
|
+
modulePath: dep
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);
|
|
348
|
+
logger.debug("User's plugins file", os.EOL, userPluginsFile);
|
|
349
|
+
for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)) {
|
|
350
|
+
if (userPluginConfig.enabled && userPluginConfig.resolve) {
|
|
351
|
+
const sysPath = convertModulePathToSystemPath(userPluginConfig.resolve);
|
|
352
|
+
plugins[userPluginName] = {
|
|
353
|
+
name: userPluginName,
|
|
354
|
+
importName: camelCase(userPluginName),
|
|
355
|
+
type: "local",
|
|
356
|
+
/**
|
|
357
|
+
* User plugin paths are resolved from the entry point
|
|
358
|
+
* of the app, because that's how you import them.
|
|
359
|
+
*/
|
|
360
|
+
modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, sysPath)),
|
|
361
|
+
path: sysPath
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return plugins;
|
|
366
|
+
};
|
|
367
|
+
const PLUGIN_CONFIGS = ["plugins.js", "plugins.mjs", "plugins.ts"];
|
|
368
|
+
const loadUserPluginsFile = async (root) => {
|
|
369
|
+
for (const file of PLUGIN_CONFIGS) {
|
|
370
|
+
const filePath = path.join(root, file);
|
|
371
|
+
const configFile = await loadFile(filePath);
|
|
372
|
+
if (configFile) {
|
|
373
|
+
return typeof configFile === "function" ? configFile({ env }) : configFile;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return {};
|
|
377
|
+
};
|
|
378
|
+
const getMapOfPluginsWithAdmin = (plugins) => Object.values(plugins).filter((plugin) => {
|
|
379
|
+
if (!plugin) {
|
|
380
|
+
return false;
|
|
381
|
+
}
|
|
382
|
+
try {
|
|
383
|
+
const isLocalPluginWithLegacyAdminFile = plugin.path && fs$1.existsSync(path.join(plugin.path, "strapi-admin.js"));
|
|
384
|
+
if (!isLocalPluginWithLegacyAdminFile) {
|
|
385
|
+
const isModuleWithFE = require.resolve(`${plugin.modulePath}/strapi-admin`);
|
|
386
|
+
return isModuleWithFE;
|
|
387
|
+
}
|
|
388
|
+
return isLocalPluginWithLegacyAdminFile;
|
|
389
|
+
} catch (err) {
|
|
390
|
+
if (isError(err) && "code" in err && err.code === "MODULE_NOT_FOUND") {
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
throw err;
|
|
394
|
+
}
|
|
395
|
+
}).map((plugin) => ({
|
|
396
|
+
...plugin,
|
|
397
|
+
modulePath: `${plugin.modulePath}/strapi-admin`
|
|
398
|
+
}));
|
|
399
|
+
const ADMIN_APP_FILES = ["app.js", "app.mjs", "app.ts", "app.jsx", "app.tsx"];
|
|
400
|
+
const loadUserAppFile = async ({
|
|
401
|
+
runtimeDir,
|
|
402
|
+
appDir
|
|
403
|
+
}) => {
|
|
404
|
+
for (const file of ADMIN_APP_FILES) {
|
|
405
|
+
const filePath = path.join(appDir, "src", "admin", file);
|
|
406
|
+
if (await pathExists(filePath)) {
|
|
407
|
+
return {
|
|
408
|
+
path: filePath,
|
|
409
|
+
modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, filePath))
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return void 0;
|
|
414
|
+
};
|
|
415
|
+
const DEFAULT_BROWSERSLIST = [
|
|
416
|
+
"last 3 major versions",
|
|
417
|
+
"Firefox ESR",
|
|
418
|
+
"last 2 Opera versions",
|
|
419
|
+
"not dead"
|
|
420
|
+
];
|
|
421
|
+
const createBuildContext = async ({
|
|
422
|
+
cwd,
|
|
423
|
+
logger,
|
|
424
|
+
tsconfig,
|
|
425
|
+
strapi,
|
|
426
|
+
options = {}
|
|
427
|
+
}) => {
|
|
428
|
+
const strapiInstance = strapi ?? strapiFactory({
|
|
429
|
+
// Directories
|
|
430
|
+
appDir: cwd,
|
|
431
|
+
distDir: tsconfig?.config.options.outDir ?? "",
|
|
432
|
+
// Options
|
|
433
|
+
autoReload: true,
|
|
434
|
+
serveAdminPanel: false
|
|
435
|
+
});
|
|
436
|
+
const { serverUrl, adminPath } = getConfigUrls(strapiInstance.config, true);
|
|
437
|
+
const appDir = strapiInstance.dirs.app.root;
|
|
438
|
+
await loadEnv(cwd);
|
|
439
|
+
const env2 = getStrapiAdminEnvVars({
|
|
440
|
+
ADMIN_PATH: adminPath,
|
|
441
|
+
STRAPI_ADMIN_BACKEND_URL: serverUrl,
|
|
442
|
+
STRAPI_TELEMETRY_DISABLED: String(strapiInstance.telemetry.isDisabled)
|
|
443
|
+
});
|
|
444
|
+
const envKeys = Object.keys(env2);
|
|
445
|
+
if (envKeys.length > 0) {
|
|
446
|
+
logger.info(
|
|
447
|
+
[
|
|
448
|
+
"Including the following ENV variables as part of the JS bundle:",
|
|
449
|
+
...envKeys.map((key) => ` - ${key}`)
|
|
450
|
+
].join(os.EOL)
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
const distPath = path.join(strapiInstance.dirs.dist.root, "build");
|
|
454
|
+
const distDir = path.relative(cwd, distPath);
|
|
455
|
+
try {
|
|
456
|
+
logger.debug(`Cleaning dist folder: ${distPath}`);
|
|
457
|
+
await fs.rm(distPath, { recursive: true, force: true });
|
|
458
|
+
logger.debug("Cleaned dist folder");
|
|
459
|
+
} catch {
|
|
460
|
+
logger.debug("There was no dist folder to clean");
|
|
461
|
+
}
|
|
462
|
+
const runtimeDir = path.join(cwd, ".strapi", "client");
|
|
463
|
+
const entry = path.relative(cwd, path.join(runtimeDir, "app.js"));
|
|
464
|
+
const plugins = await getEnabledPlugins({ cwd, logger, runtimeDir, strapi: strapiInstance });
|
|
465
|
+
logger.debug("Enabled plugins", os.EOL, plugins);
|
|
466
|
+
const pluginsWithFront = getMapOfPluginsWithAdmin(plugins);
|
|
467
|
+
logger.debug("Enabled plugins with FE", os.EOL, plugins);
|
|
468
|
+
const target = browserslist.loadConfig({ path: cwd }) ?? DEFAULT_BROWSERSLIST;
|
|
469
|
+
const customisations = await loadUserAppFile({ appDir, runtimeDir });
|
|
470
|
+
const buildContext = {
|
|
471
|
+
appDir,
|
|
472
|
+
basePath: `${adminPath}/`,
|
|
473
|
+
customisations,
|
|
474
|
+
cwd,
|
|
475
|
+
distDir,
|
|
476
|
+
distPath,
|
|
477
|
+
entry,
|
|
478
|
+
env: env2,
|
|
479
|
+
logger,
|
|
480
|
+
options,
|
|
481
|
+
plugins: pluginsWithFront,
|
|
482
|
+
runtimeDir,
|
|
483
|
+
strapi: strapiInstance,
|
|
484
|
+
target,
|
|
485
|
+
tsconfig
|
|
486
|
+
};
|
|
487
|
+
return buildContext;
|
|
488
|
+
};
|
|
230
489
|
const styles = `
|
|
231
490
|
.strapi--root {
|
|
232
491
|
position: absolute;
|
|
@@ -406,50 +665,15 @@ async function loadStrapiMonorepo(cwd) {
|
|
|
406
665
|
while (p !== "/") {
|
|
407
666
|
const readResult = await readPkgUp({ cwd: p });
|
|
408
667
|
if (!readResult) {
|
|
409
|
-
return void 0;
|
|
410
|
-
}
|
|
411
|
-
if (readResult.packageJson.isStrapiMonorepo) {
|
|
412
|
-
return { path: path$1.dirname(readResult.path) };
|
|
413
|
-
}
|
|
414
|
-
p = path$1.dirname(path$1.dirname(readResult.path));
|
|
415
|
-
}
|
|
416
|
-
return void 0;
|
|
417
|
-
}
|
|
418
|
-
const pathExists = async (path2) => {
|
|
419
|
-
try {
|
|
420
|
-
await access(path2);
|
|
421
|
-
return true;
|
|
422
|
-
} catch (error) {
|
|
423
|
-
return false;
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
const loadFile = async (path2) => {
|
|
427
|
-
if (await pathExists(path2)) {
|
|
428
|
-
const esbuildOptions = {
|
|
429
|
-
extensions: [".js", ".mjs", ".ts"]
|
|
430
|
-
};
|
|
431
|
-
const { unregister } = register(esbuildOptions);
|
|
432
|
-
const mod = require(path2);
|
|
433
|
-
unregister();
|
|
434
|
-
const file = mod?.default || mod || void 0;
|
|
435
|
-
return file;
|
|
436
|
-
}
|
|
437
|
-
return void 0;
|
|
438
|
-
};
|
|
439
|
-
const convertSystemPathToModulePath = (sysPath) => {
|
|
440
|
-
if (process.platform === "win32") {
|
|
441
|
-
return sysPath.split(path.sep).join(path.posix.sep);
|
|
442
|
-
} else {
|
|
443
|
-
return sysPath;
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
const convertModulePathToSystemPath = (modulePath) => {
|
|
447
|
-
if (process.platform === "win32") {
|
|
448
|
-
return modulePath.split(path.posix.sep).join(path.sep);
|
|
449
|
-
} else {
|
|
450
|
-
return modulePath;
|
|
668
|
+
return void 0;
|
|
669
|
+
}
|
|
670
|
+
if (readResult.packageJson.isStrapiMonorepo) {
|
|
671
|
+
return { path: path$1.dirname(readResult.path) };
|
|
672
|
+
}
|
|
673
|
+
p = path$1.dirname(path$1.dirname(readResult.path));
|
|
451
674
|
}
|
|
452
|
-
|
|
675
|
+
return void 0;
|
|
676
|
+
}
|
|
453
677
|
const resolveBaseConfig = async (ctx) => {
|
|
454
678
|
const monorepo = await loadStrapiMonorepo(ctx.cwd);
|
|
455
679
|
const target = browserslistToEsbuild(ctx.target);
|
|
@@ -652,27 +876,6 @@ const mergeConfigWithUserConfig = async (config, ctx) => {
|
|
|
652
876
|
}
|
|
653
877
|
return config;
|
|
654
878
|
};
|
|
655
|
-
const isError = (err) => err instanceof Error;
|
|
656
|
-
const handleUnexpectedError = (err) => {
|
|
657
|
-
console.error(
|
|
658
|
-
chalk.red(
|
|
659
|
-
`[ERROR] `,
|
|
660
|
-
"There seems to be an unexpected error, try again with --debug for more information",
|
|
661
|
-
os.EOL
|
|
662
|
-
)
|
|
663
|
-
);
|
|
664
|
-
if (isError(err) && err.stack) {
|
|
665
|
-
console.log(
|
|
666
|
-
chalk.red(
|
|
667
|
-
boxen(err.stack, {
|
|
668
|
-
padding: 1,
|
|
669
|
-
align: "left"
|
|
670
|
-
})
|
|
671
|
-
)
|
|
672
|
-
);
|
|
673
|
-
}
|
|
674
|
-
process.exit(1);
|
|
675
|
-
};
|
|
676
879
|
const build$1 = async (ctx) => new Promise(async (resolve, reject) => {
|
|
677
880
|
const config = await resolveProductionConfig(ctx);
|
|
678
881
|
const finalConfig = await mergeConfigWithUserConfig(config, ctx);
|
|
@@ -703,206 +906,6 @@ const build$1 = async (ctx) => new Promise(async (resolve, reject) => {
|
|
|
703
906
|
}
|
|
704
907
|
});
|
|
705
908
|
});
|
|
706
|
-
const loadEnv = async (cwd) => {
|
|
707
|
-
const pathToEnv = path.resolve(cwd, ".env");
|
|
708
|
-
if (await pathExists(pathToEnv)) {
|
|
709
|
-
dotenv.config({ path: pathToEnv });
|
|
710
|
-
}
|
|
711
|
-
};
|
|
712
|
-
const getStrapiAdminEnvVars = (defaultEnv) => {
|
|
713
|
-
return Object.keys(process.env).filter((key) => key.toUpperCase().startsWith("STRAPI_ADMIN_")).reduce((acc, key) => {
|
|
714
|
-
acc[key] = process.env[key];
|
|
715
|
-
return acc;
|
|
716
|
-
}, defaultEnv);
|
|
717
|
-
};
|
|
718
|
-
const validatePackageHasStrapi = (pkg) => "strapi" in pkg && typeof pkg.strapi === "object" && !Array.isArray(pkg.strapi) && pkg.strapi !== null;
|
|
719
|
-
const validatePackageIsPlugin = (pkg) => validatePackageHasStrapi(pkg) && pkg.strapi.kind === "plugin";
|
|
720
|
-
const getEnabledPlugins = async ({
|
|
721
|
-
cwd,
|
|
722
|
-
logger,
|
|
723
|
-
runtimeDir,
|
|
724
|
-
strapi
|
|
725
|
-
}) => {
|
|
726
|
-
const plugins = {};
|
|
727
|
-
const deps = strapi.config.get("info.dependencies", {});
|
|
728
|
-
logger.debug("Dependencies from user's project", os.EOL, deps);
|
|
729
|
-
for (const dep of Object.keys(deps)) {
|
|
730
|
-
const pkg = await getModule(dep, cwd);
|
|
731
|
-
if (pkg && validatePackageIsPlugin(pkg)) {
|
|
732
|
-
const name = pkg.strapi.name || pkg.name;
|
|
733
|
-
if (!name) {
|
|
734
|
-
throw Error(
|
|
735
|
-
"You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!"
|
|
736
|
-
);
|
|
737
|
-
}
|
|
738
|
-
plugins[name] = {
|
|
739
|
-
name,
|
|
740
|
-
importName: camelCase(name),
|
|
741
|
-
type: "module",
|
|
742
|
-
modulePath: dep
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);
|
|
747
|
-
logger.debug("User's plugins file", os.EOL, userPluginsFile);
|
|
748
|
-
for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)) {
|
|
749
|
-
if (userPluginConfig.enabled && userPluginConfig.resolve) {
|
|
750
|
-
const sysPath = convertModulePathToSystemPath(userPluginConfig.resolve);
|
|
751
|
-
plugins[userPluginName] = {
|
|
752
|
-
name: userPluginName,
|
|
753
|
-
importName: camelCase(userPluginName),
|
|
754
|
-
type: "local",
|
|
755
|
-
/**
|
|
756
|
-
* User plugin paths are resolved from the entry point
|
|
757
|
-
* of the app, because that's how you import them.
|
|
758
|
-
*/
|
|
759
|
-
modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, sysPath)),
|
|
760
|
-
path: sysPath
|
|
761
|
-
};
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
return plugins;
|
|
765
|
-
};
|
|
766
|
-
const PLUGIN_CONFIGS = ["plugins.js", "plugins.mjs", "plugins.ts"];
|
|
767
|
-
const loadUserPluginsFile = async (root) => {
|
|
768
|
-
for (const file of PLUGIN_CONFIGS) {
|
|
769
|
-
const filePath = path.join(root, file);
|
|
770
|
-
const configFile = await loadFile(filePath);
|
|
771
|
-
if (configFile) {
|
|
772
|
-
return typeof configFile === "function" ? configFile({ env }) : configFile;
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
return {};
|
|
776
|
-
};
|
|
777
|
-
const getMapOfPluginsWithAdmin = (plugins) => Object.values(plugins).filter((plugin) => {
|
|
778
|
-
if (!plugin) {
|
|
779
|
-
return false;
|
|
780
|
-
}
|
|
781
|
-
try {
|
|
782
|
-
const isLocalPluginWithLegacyAdminFile = plugin.path && fs$1.existsSync(path.join(plugin.path, "strapi-admin.js"));
|
|
783
|
-
if (!isLocalPluginWithLegacyAdminFile) {
|
|
784
|
-
const isModuleWithFE = require.resolve(`${plugin.modulePath}/strapi-admin`);
|
|
785
|
-
return isModuleWithFE;
|
|
786
|
-
}
|
|
787
|
-
return isLocalPluginWithLegacyAdminFile;
|
|
788
|
-
} catch (err) {
|
|
789
|
-
if (isError(err) && "code" in err && err.code === "MODULE_NOT_FOUND") {
|
|
790
|
-
return false;
|
|
791
|
-
}
|
|
792
|
-
throw err;
|
|
793
|
-
}
|
|
794
|
-
}).map((plugin) => ({
|
|
795
|
-
...plugin,
|
|
796
|
-
modulePath: `${plugin.modulePath}/strapi-admin`
|
|
797
|
-
}));
|
|
798
|
-
const ADMIN_APP_FILES = ["app.js", "app.mjs", "app.ts", "app.jsx", "app.tsx"];
|
|
799
|
-
const loadUserAppFile = async ({
|
|
800
|
-
runtimeDir,
|
|
801
|
-
appDir
|
|
802
|
-
}) => {
|
|
803
|
-
for (const file of ADMIN_APP_FILES) {
|
|
804
|
-
const filePath = path.join(appDir, "src", "admin", file);
|
|
805
|
-
if (await pathExists(filePath)) {
|
|
806
|
-
return {
|
|
807
|
-
path: filePath,
|
|
808
|
-
modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, filePath))
|
|
809
|
-
};
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
return void 0;
|
|
813
|
-
};
|
|
814
|
-
const DEFAULT_BROWSERSLIST = [
|
|
815
|
-
"last 3 major versions",
|
|
816
|
-
"Firefox ESR",
|
|
817
|
-
"last 2 Opera versions",
|
|
818
|
-
"not dead"
|
|
819
|
-
];
|
|
820
|
-
const createBuildContext = async ({
|
|
821
|
-
cwd,
|
|
822
|
-
logger,
|
|
823
|
-
tsconfig,
|
|
824
|
-
strapi,
|
|
825
|
-
options = {}
|
|
826
|
-
}) => {
|
|
827
|
-
const strapiInstance = strapi ?? strapiFactory({
|
|
828
|
-
// Directories
|
|
829
|
-
appDir: cwd,
|
|
830
|
-
distDir: tsconfig?.config.options.outDir ?? "",
|
|
831
|
-
// Options
|
|
832
|
-
autoReload: true,
|
|
833
|
-
serveAdminPanel: false
|
|
834
|
-
});
|
|
835
|
-
const { serverUrl, adminPath } = getConfigUrls(strapiInstance.config, true);
|
|
836
|
-
const appDir = strapiInstance.dirs.app.root;
|
|
837
|
-
await loadEnv(cwd);
|
|
838
|
-
const env2 = getStrapiAdminEnvVars({
|
|
839
|
-
ADMIN_PATH: adminPath,
|
|
840
|
-
STRAPI_ADMIN_BACKEND_URL: serverUrl,
|
|
841
|
-
STRAPI_TELEMETRY_DISABLED: String(strapiInstance.telemetry.isDisabled)
|
|
842
|
-
});
|
|
843
|
-
const envKeys = Object.keys(env2);
|
|
844
|
-
if (envKeys.length > 0) {
|
|
845
|
-
logger.info(
|
|
846
|
-
[
|
|
847
|
-
"Including the following ENV variables as part of the JS bundle:",
|
|
848
|
-
...envKeys.map((key) => ` - ${key}`)
|
|
849
|
-
].join(os.EOL)
|
|
850
|
-
);
|
|
851
|
-
}
|
|
852
|
-
const distPath = path.join(strapiInstance.dirs.dist.root, "build");
|
|
853
|
-
const distDir = path.relative(cwd, distPath);
|
|
854
|
-
try {
|
|
855
|
-
logger.debug(`Cleaning dist folder: ${distPath}`);
|
|
856
|
-
await fs.rm(distPath, { recursive: true, force: true });
|
|
857
|
-
logger.debug("Cleaned dist folder");
|
|
858
|
-
} catch {
|
|
859
|
-
logger.debug("There was no dist folder to clean");
|
|
860
|
-
}
|
|
861
|
-
const runtimeDir = path.join(cwd, ".strapi", "client");
|
|
862
|
-
const entry = path.relative(cwd, path.join(runtimeDir, "app.js"));
|
|
863
|
-
const plugins = await getEnabledPlugins({ cwd, logger, runtimeDir, strapi: strapiInstance });
|
|
864
|
-
logger.debug("Enabled plugins", os.EOL, plugins);
|
|
865
|
-
const pluginsWithFront = getMapOfPluginsWithAdmin(plugins);
|
|
866
|
-
logger.debug("Enabled plugins with FE", os.EOL, plugins);
|
|
867
|
-
const target = browserslist.loadConfig({ path: cwd }) ?? DEFAULT_BROWSERSLIST;
|
|
868
|
-
const customisations = await loadUserAppFile({ appDir, runtimeDir });
|
|
869
|
-
const buildContext = {
|
|
870
|
-
appDir,
|
|
871
|
-
basePath: `${adminPath}/`,
|
|
872
|
-
customisations,
|
|
873
|
-
cwd,
|
|
874
|
-
distDir,
|
|
875
|
-
distPath,
|
|
876
|
-
entry,
|
|
877
|
-
env: env2,
|
|
878
|
-
logger,
|
|
879
|
-
options,
|
|
880
|
-
plugins: pluginsWithFront,
|
|
881
|
-
runtimeDir,
|
|
882
|
-
strapi: strapiInstance,
|
|
883
|
-
target,
|
|
884
|
-
tsconfig
|
|
885
|
-
};
|
|
886
|
-
return buildContext;
|
|
887
|
-
};
|
|
888
|
-
function getTimer() {
|
|
889
|
-
const timings = {};
|
|
890
|
-
const startTimes = {};
|
|
891
|
-
function start(name) {
|
|
892
|
-
if (typeof startTimes[name] !== "undefined") {
|
|
893
|
-
throw new Error(`Timer "${name}" already started, cannot overwrite`);
|
|
894
|
-
}
|
|
895
|
-
startTimes[name] = performance.now();
|
|
896
|
-
}
|
|
897
|
-
function end(name) {
|
|
898
|
-
if (typeof startTimes[name] === "undefined") {
|
|
899
|
-
throw new Error(`Timer "${name}" never started, cannot end`);
|
|
900
|
-
}
|
|
901
|
-
timings[name] = performance.now() - startTimes[name];
|
|
902
|
-
return timings[name];
|
|
903
|
-
}
|
|
904
|
-
return { start, end, getTimings: () => timings };
|
|
905
|
-
}
|
|
906
909
|
const build = async ({ logger, cwd, tsconfig, ignorePrompts, ...options }) => {
|
|
907
910
|
const timer = getTimer();
|
|
908
911
|
const { didInstall } = await checkRequiredDependencies({ cwd, logger, ignorePrompts }).catch(
|
|
@@ -919,7 +922,7 @@ const build = async ({ logger, cwd, tsconfig, ignorePrompts, ...options }) => {
|
|
|
919
922
|
const compilingTsSpinner = logger.spinner(`Compiling TS`).start();
|
|
920
923
|
tsUtils.compile(cwd, { configOptions: { ignoreDiagnostics: false } });
|
|
921
924
|
const compilingDuration = timer.end("compilingTS");
|
|
922
|
-
compilingTsSpinner.text = `Compiling TS (${compilingDuration}
|
|
925
|
+
compilingTsSpinner.text = `Compiling TS (${prettyTime(compilingDuration)})`;
|
|
923
926
|
compilingTsSpinner.succeed();
|
|
924
927
|
}
|
|
925
928
|
timer.start("createBuildContext");
|
|
@@ -932,7 +935,7 @@ const build = async ({ logger, cwd, tsconfig, ignorePrompts, ...options }) => {
|
|
|
932
935
|
options
|
|
933
936
|
});
|
|
934
937
|
const contextDuration = timer.end("createBuildContext");
|
|
935
|
-
contextSpinner.text = `Building build context (${contextDuration}
|
|
938
|
+
contextSpinner.text = `Building build context (${prettyTime(contextDuration)})`;
|
|
936
939
|
contextSpinner.succeed();
|
|
937
940
|
timer.start("buildAdmin");
|
|
938
941
|
const buildingSpinner = logger.spinner(`Building admin panel`).start();
|
|
@@ -942,7 +945,7 @@ const build = async ({ logger, cwd, tsconfig, ignorePrompts, ...options }) => {
|
|
|
942
945
|
await writeStaticClientFiles(ctx);
|
|
943
946
|
await build$1(ctx);
|
|
944
947
|
const buildDuration = timer.end("buildAdmin");
|
|
945
|
-
buildingSpinner.text = `Building admin panel (${buildDuration}
|
|
948
|
+
buildingSpinner.text = `Building admin panel (${prettyTime(buildDuration)})`;
|
|
946
949
|
buildingSpinner.succeed();
|
|
947
950
|
} catch (err) {
|
|
948
951
|
buildingSpinner.fail();
|
|
@@ -1030,6 +1033,35 @@ const watch = async (ctx) => {
|
|
|
1030
1033
|
});
|
|
1031
1034
|
});
|
|
1032
1035
|
};
|
|
1036
|
+
const cleanupDistDirectory = async ({
|
|
1037
|
+
tsconfig,
|
|
1038
|
+
logger,
|
|
1039
|
+
timer
|
|
1040
|
+
}) => {
|
|
1041
|
+
const distDir = tsconfig?.config?.options?.outDir;
|
|
1042
|
+
if (!distDir || // we don't have a dist dir
|
|
1043
|
+
await fs.access(distDir).then(() => false).catch(() => true)) {
|
|
1044
|
+
return;
|
|
1045
|
+
}
|
|
1046
|
+
const timerName = "cleaningDist" + Date.now();
|
|
1047
|
+
timer.start(timerName);
|
|
1048
|
+
const cleaningSpinner = logger.spinner(`Cleaning dist dir ${distDir}`).start();
|
|
1049
|
+
try {
|
|
1050
|
+
const dirContent = await fs.readdir(distDir);
|
|
1051
|
+
const validFilenames = dirContent.filter((filename) => filename !== "build");
|
|
1052
|
+
for (const filename of validFilenames) {
|
|
1053
|
+
await fs.rm(path.resolve(distDir, filename), { recursive: true });
|
|
1054
|
+
}
|
|
1055
|
+
} catch (err) {
|
|
1056
|
+
const generatingDuration2 = timer.end(timerName);
|
|
1057
|
+
cleaningSpinner.text = `Error cleaning dist dir: ${err} (${prettyTime(generatingDuration2)})`;
|
|
1058
|
+
cleaningSpinner?.fail();
|
|
1059
|
+
return;
|
|
1060
|
+
}
|
|
1061
|
+
const generatingDuration = timer.end(timerName);
|
|
1062
|
+
cleaningSpinner.text = `Cleaning dist dir (${prettyTime(generatingDuration)})`;
|
|
1063
|
+
cleaningSpinner?.succeed();
|
|
1064
|
+
};
|
|
1033
1065
|
const develop = async ({
|
|
1034
1066
|
cwd,
|
|
1035
1067
|
polling,
|
|
@@ -1050,6 +1082,10 @@ const develop = async ({
|
|
|
1050
1082
|
if (didInstall) {
|
|
1051
1083
|
return;
|
|
1052
1084
|
}
|
|
1085
|
+
if (tsconfig?.config) {
|
|
1086
|
+
await cleanupDistDirectory({ tsconfig, logger, timer });
|
|
1087
|
+
await tsUtils.compile(cwd, { configOptions: { ignoreDiagnostics: true } });
|
|
1088
|
+
}
|
|
1053
1089
|
if (!watchAdmin) {
|
|
1054
1090
|
timer.start("createBuildContext");
|
|
1055
1091
|
const contextSpinner = logger.spinner(`Building build context`).start();
|
|
@@ -1061,7 +1097,7 @@ const develop = async ({
|
|
|
1061
1097
|
options
|
|
1062
1098
|
});
|
|
1063
1099
|
const contextDuration = timer.end("createBuildContext");
|
|
1064
|
-
contextSpinner.text = `Building build context (${contextDuration}
|
|
1100
|
+
contextSpinner.text = `Building build context (${prettyTime(contextDuration)})`;
|
|
1065
1101
|
contextSpinner.succeed();
|
|
1066
1102
|
timer.start("creatingAdmin");
|
|
1067
1103
|
const adminSpinner = logger.spinner(`Creating admin`).start();
|
|
@@ -1069,12 +1105,16 @@ const develop = async ({
|
|
|
1069
1105
|
await writeStaticClientFiles(ctx);
|
|
1070
1106
|
await build$1(ctx);
|
|
1071
1107
|
const adminDuration = timer.end("creatingAdmin");
|
|
1072
|
-
adminSpinner.text = `Creating admin (${adminDuration}
|
|
1108
|
+
adminSpinner.text = `Creating admin (${prettyTime(adminDuration)})`;
|
|
1073
1109
|
adminSpinner.succeed();
|
|
1074
1110
|
}
|
|
1075
1111
|
cluster.on("message", async (worker, message) => {
|
|
1076
1112
|
switch (message) {
|
|
1077
1113
|
case "reload": {
|
|
1114
|
+
if (tsconfig?.config) {
|
|
1115
|
+
await cleanupDistDirectory({ tsconfig, logger, timer });
|
|
1116
|
+
await tsUtils.compile(cwd, { configOptions: { ignoreDiagnostics: true } });
|
|
1117
|
+
}
|
|
1078
1118
|
logger.debug("cluster has the reload message, sending the worker kill message");
|
|
1079
1119
|
worker.send("kill");
|
|
1080
1120
|
break;
|
|
@@ -1093,14 +1133,8 @@ const develop = async ({
|
|
|
1093
1133
|
cluster.fork();
|
|
1094
1134
|
}
|
|
1095
1135
|
if (cluster.isWorker) {
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
const compilingTsSpinner = logger.spinner(`Compiling TS`).start();
|
|
1099
|
-
tsUtils.compile(cwd, { configOptions: { ignoreDiagnostics: false } });
|
|
1100
|
-
const compilingDuration = timer.end("compilingTS");
|
|
1101
|
-
compilingTsSpinner.text = `Compiling TS (${compilingDuration}ms)`;
|
|
1102
|
-
compilingTsSpinner.succeed();
|
|
1103
|
-
}
|
|
1136
|
+
timer.start("loadStrapi");
|
|
1137
|
+
const loadStrapiSpinner = logger.spinner(`Loading Strapi`).start();
|
|
1104
1138
|
const strapi = strapiFactory({
|
|
1105
1139
|
appDir: cwd,
|
|
1106
1140
|
distDir: tsconfig?.config.options.outDir ?? "",
|
|
@@ -1120,7 +1154,7 @@ const develop = async ({
|
|
|
1120
1154
|
options
|
|
1121
1155
|
});
|
|
1122
1156
|
const contextDuration = timer.end("createBuildContext");
|
|
1123
|
-
contextSpinner.text = `Building build context (${contextDuration}
|
|
1157
|
+
contextSpinner.text = `Building build context (${prettyTime(contextDuration)})`;
|
|
1124
1158
|
contextSpinner.succeed();
|
|
1125
1159
|
timer.start("creatingAdmin");
|
|
1126
1160
|
const adminSpinner = logger.spinner(`Creating admin`).start();
|
|
@@ -1128,10 +1162,13 @@ const develop = async ({
|
|
|
1128
1162
|
await writeStaticClientFiles(ctx);
|
|
1129
1163
|
webpackWatcher = await watch(ctx);
|
|
1130
1164
|
const adminDuration = timer.end("creatingAdmin");
|
|
1131
|
-
adminSpinner.text = `Creating admin (${adminDuration}
|
|
1165
|
+
adminSpinner.text = `Creating admin (${prettyTime(adminDuration)})`;
|
|
1132
1166
|
adminSpinner.succeed();
|
|
1133
1167
|
}
|
|
1134
1168
|
const strapiInstance = await strapi.load();
|
|
1169
|
+
const loadStrapiDuration = timer.end("loadStrapi");
|
|
1170
|
+
loadStrapiSpinner.text = `Loading Strapi (${prettyTime(loadStrapiDuration)})`;
|
|
1171
|
+
loadStrapiSpinner.succeed();
|
|
1135
1172
|
timer.start("generatingTS");
|
|
1136
1173
|
const generatingTsSpinner = logger.spinner(`Generating types`).start();
|
|
1137
1174
|
await tsUtils.generators.generate({
|
|
@@ -1142,8 +1179,17 @@ const develop = async ({
|
|
|
1142
1179
|
artifacts: { contentTypes: true, components: true }
|
|
1143
1180
|
});
|
|
1144
1181
|
const generatingDuration = timer.end("generatingTS");
|
|
1145
|
-
generatingTsSpinner.text = `Generating types (${generatingDuration}
|
|
1182
|
+
generatingTsSpinner.text = `Generating types (${prettyTime(generatingDuration)})`;
|
|
1146
1183
|
generatingTsSpinner.succeed();
|
|
1184
|
+
if (tsconfig?.config) {
|
|
1185
|
+
timer.start("compilingTS");
|
|
1186
|
+
const compilingTsSpinner = logger.spinner(`Compiling TS`).start();
|
|
1187
|
+
await cleanupDistDirectory({ tsconfig, logger, timer });
|
|
1188
|
+
await tsUtils.compile(cwd, { configOptions: { ignoreDiagnostics: false } });
|
|
1189
|
+
const compilingDuration = timer.end("compilingTS");
|
|
1190
|
+
compilingTsSpinner.text = `Compiling TS (${prettyTime(compilingDuration)})`;
|
|
1191
|
+
compilingTsSpinner.succeed();
|
|
1192
|
+
}
|
|
1147
1193
|
const restart = async () => {
|
|
1148
1194
|
if (strapiInstance.reload.isWatching && !strapiInstance.reload.isReloading) {
|
|
1149
1195
|
strapiInstance.reload.isReloading = true;
|
|
@@ -1213,4 +1259,4 @@ export {
|
|
|
1213
1259
|
handleUnexpectedError as h,
|
|
1214
1260
|
index as i
|
|
1215
1261
|
};
|
|
1216
|
-
//# sourceMappingURL=index-
|
|
1262
|
+
//# sourceMappingURL=index-dc89c18c.mjs.map
|