@strapi/admin 4.15.5-alpha.2 → 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-4b160235.js → AuthenticatedApp-31e6418d.js} +21 -21
- package/dist/_chunks/{AuthenticatedApp-4b160235.js.map → AuthenticatedApp-31e6418d.js.map} +1 -1
- package/dist/_chunks/{AuthenticatedApp-fa931d1d.mjs → AuthenticatedApp-52d37e32.mjs} +21 -21
- package/dist/_chunks/{AuthenticatedApp-fa931d1d.mjs.map → AuthenticatedApp-52d37e32.mjs.map} +1 -1
- package/dist/_chunks/{HomePage-b91d1592.js → HomePage-0f953b49.js} +4 -4
- package/dist/_chunks/{HomePage-b91d1592.js.map → HomePage-0f953b49.js.map} +1 -1
- package/dist/_chunks/{HomePage-8e98be60.mjs → HomePage-1e7b2e66.mjs} +4 -4
- package/dist/_chunks/{HomePage-8e98be60.mjs.map → HomePage-1e7b2e66.mjs.map} +1 -1
- package/dist/_chunks/{HomePage-9bda39b5.mjs → HomePage-a2c12504.mjs} +4 -4
- package/dist/_chunks/{HomePage-9bda39b5.mjs.map → HomePage-a2c12504.mjs.map} +1 -1
- package/dist/_chunks/{HomePage-b6967648.js → HomePage-d0f7fc69.js} +4 -4
- package/dist/_chunks/{HomePage-b6967648.js.map → HomePage-d0f7fc69.js.map} +1 -1
- package/dist/_chunks/{InstalledPluginsPage-ee6d69b0.mjs → InstalledPluginsPage-3fc71003.mjs} +3 -3
- package/dist/_chunks/{InstalledPluginsPage-ee6d69b0.mjs.map → InstalledPluginsPage-3fc71003.mjs.map} +1 -1
- package/dist/_chunks/{InstalledPluginsPage-d4b90e9c.js → InstalledPluginsPage-46e14507.js} +3 -3
- package/dist/_chunks/{InstalledPluginsPage-d4b90e9c.js.map → InstalledPluginsPage-46e14507.js.map} +1 -1
- package/dist/_chunks/{Login-5fbf37c3.js → Login-550366a9.js} +2 -2
- package/dist/_chunks/{Login-5fbf37c3.js.map → Login-550366a9.js.map} +1 -1
- package/dist/_chunks/{Login-4fc5dcbb.mjs → Login-57e0fd9c.mjs} +2 -2
- package/dist/_chunks/{Login-4fc5dcbb.mjs.map → Login-57e0fd9c.mjs.map} +1 -1
- package/dist/_chunks/{MarketplacePage-ff0d02c6.js → MarketplacePage-138e7b39.js} +3 -3
- package/dist/_chunks/{MarketplacePage-ff0d02c6.js.map → MarketplacePage-138e7b39.js.map} +1 -1
- package/dist/_chunks/{MarketplacePage-ec9bf1db.mjs → MarketplacePage-2505749a.mjs} +3 -3
- package/dist/_chunks/{MarketplacePage-ec9bf1db.mjs.map → MarketplacePage-2505749a.mjs.map} +1 -1
- package/dist/_chunks/{ProfilePage-96a8404e.js → ProfilePage-23b8a29f.js} +3 -3
- package/dist/_chunks/{ProfilePage-96a8404e.js.map → ProfilePage-23b8a29f.js.map} +1 -1
- package/dist/_chunks/{ProfilePage-caeace8c.mjs → ProfilePage-bd50b4f3.mjs} +3 -3
- package/dist/_chunks/{ProfilePage-caeace8c.mjs.map → ProfilePage-bd50b4f3.mjs.map} +1 -1
- package/dist/_chunks/{build-f011d8dc.mjs → build-92e15b93.mjs} +13 -13
- package/dist/_chunks/{build-f011d8dc.mjs.map → build-92e15b93.mjs.map} +1 -1
- package/dist/_chunks/{build-b285bccd.js → build-df2f219f.js} +13 -13
- package/dist/_chunks/{build-b285bccd.js.map → build-df2f219f.js.map} +1 -1
- package/dist/_chunks/{constants-916debf1.js → constants-06897e38.js} +2 -2
- package/dist/_chunks/{constants-916debf1.js.map → constants-06897e38.js.map} +1 -1
- package/dist/_chunks/{constants-129cf022.mjs → constants-362e760f.mjs} +6 -6
- package/dist/_chunks/{constants-129cf022.mjs.map → constants-362e760f.mjs.map} +1 -1
- package/dist/_chunks/{constants-1bd1239d.js → constants-4539f7ac.js} +6 -6
- package/dist/_chunks/{constants-1bd1239d.js.map → constants-4539f7ac.js.map} +1 -1
- package/dist/_chunks/{constants-39df4f04.mjs → constants-59bcff2e.mjs} +3 -3
- package/dist/_chunks/{constants-39df4f04.mjs.map → constants-59bcff2e.mjs.map} +1 -1
- package/dist/_chunks/{constants-7bfc7134.mjs → constants-6dcb43aa.mjs} +2 -2
- package/dist/_chunks/{constants-7bfc7134.mjs.map → constants-6dcb43aa.mjs.map} +1 -1
- package/dist/_chunks/{constants-86882708.js → constants-88f9d2a0.js} +3 -3
- package/dist/_chunks/{constants-86882708.js.map → constants-88f9d2a0.js.map} +1 -1
- package/dist/_chunks/{constants-cd5a4e71.js → constants-ac7899ed.js} +5 -5
- package/dist/_chunks/{constants-cd5a4e71.js.map → constants-ac7899ed.js.map} +1 -1
- package/dist/_chunks/{constants-ffa23daa.mjs → constants-e2c67ec8.mjs} +5 -5
- package/dist/_chunks/{constants-ffa23daa.mjs.map → constants-e2c67ec8.mjs.map} +1 -1
- package/dist/_chunks/{develop-9765d7ba.js → develop-4d25a6e0.js} +13 -13
- package/dist/_chunks/{develop-9765d7ba.js.map → develop-4d25a6e0.js.map} +1 -1
- package/dist/_chunks/{develop-3c9f7452.mjs → develop-a46fed01.mjs} +13 -13
- package/dist/_chunks/{develop-3c9f7452.mjs.map → develop-a46fed01.mjs.map} +1 -1
- package/dist/_chunks/{index-f18d27fd.js → index-02064a74.js} +3 -3
- package/dist/_chunks/{index-f18d27fd.js.map → index-02064a74.js.map} +1 -1
- package/dist/_chunks/{index-332b3702.mjs → index-03e8b9e3.mjs} +3 -3
- package/dist/_chunks/{index-332b3702.mjs.map → index-03e8b9e3.mjs.map} +1 -1
- package/dist/_chunks/{index-539c5eac.js → index-074a5de8.js} +2 -2
- package/dist/_chunks/{index-539c5eac.js.map → index-074a5de8.js.map} +1 -1
- package/dist/_chunks/{index-e2db7aa8.mjs → index-0778959c.mjs} +6 -6
- package/dist/_chunks/{index-e2db7aa8.mjs.map → index-0778959c.mjs.map} +1 -1
- package/dist/_chunks/{index-455d0b3e.js → index-0b787ac1.js} +5 -5
- package/dist/_chunks/{index-455d0b3e.js.map → index-0b787ac1.js.map} +1 -1
- package/dist/_chunks/{index-7c0dcf2b.js → index-133699a3.js} +4 -4
- package/dist/_chunks/{index-7c0dcf2b.js.map → index-133699a3.js.map} +1 -1
- package/dist/_chunks/{index-6861cd84.mjs → index-13ab14ec.mjs} +3 -3
- package/dist/_chunks/{index-6861cd84.mjs.map → index-13ab14ec.mjs.map} +1 -1
- package/dist/_chunks/{index-d196ac50.js → index-148939b0.js} +4 -4
- package/dist/_chunks/{index-d196ac50.js.map → index-148939b0.js.map} +1 -1
- package/dist/_chunks/{index-891d1527.mjs → index-15c76f0b.mjs} +4 -4
- package/dist/_chunks/{index-891d1527.mjs.map → index-15c76f0b.mjs.map} +1 -1
- package/dist/_chunks/{index-653e1ab3.js → index-19b1984d.js} +2 -2
- package/dist/_chunks/{index-653e1ab3.js.map → index-19b1984d.js.map} +1 -1
- package/dist/_chunks/{index-d33c8d9f.mjs → index-1a3e997a.mjs} +8 -8
- package/dist/_chunks/{index-d33c8d9f.mjs.map → index-1a3e997a.mjs.map} +1 -1
- package/dist/_chunks/{index-62b7bdbe.js → index-1a74fa41.js} +343 -285
- package/dist/_chunks/index-1a74fa41.js.map +1 -0
- package/dist/_chunks/{index-d80de23d.mjs → index-1a7cc203.mjs} +3 -3
- package/dist/_chunks/{index-d80de23d.mjs.map → index-1a7cc203.mjs.map} +1 -1
- package/dist/_chunks/{index-f4a061be.mjs → index-23925f10.mjs} +2 -2
- package/dist/_chunks/{index-f4a061be.mjs.map → index-23925f10.mjs.map} +1 -1
- package/dist/_chunks/{index-006ef0ac.js → index-24b626a6.js} +3 -3
- package/dist/_chunks/{index-006ef0ac.js.map → index-24b626a6.js.map} +1 -1
- package/dist/_chunks/{index-43e86c36.mjs → index-2b48526d.mjs} +5 -5
- package/dist/_chunks/{index-43e86c36.mjs.map → index-2b48526d.mjs.map} +1 -1
- package/dist/_chunks/{index-6bfd0b33.js → index-2c76e5e2.js} +3 -3
- package/dist/_chunks/{index-6bfd0b33.js.map → index-2c76e5e2.js.map} +1 -1
- package/dist/_chunks/{index-54dc318d.js → index-36a7c525.js} +3 -3
- package/dist/_chunks/{index-54dc318d.js.map → index-36a7c525.js.map} +1 -1
- package/dist/_chunks/{index-df043af5.mjs → index-3a96c79f.mjs} +3 -3
- package/dist/_chunks/{index-df043af5.mjs.map → index-3a96c79f.mjs.map} +1 -1
- package/dist/_chunks/{index-57ae9065.mjs → index-3be46ca9.mjs} +3 -3
- package/dist/_chunks/{index-57ae9065.mjs.map → index-3be46ca9.mjs.map} +1 -1
- package/dist/_chunks/{index-9b3ff96c.mjs → index-4544af4c.mjs} +20 -20
- package/dist/_chunks/{index-9b3ff96c.mjs.map → index-4544af4c.mjs.map} +1 -1
- package/dist/_chunks/{index-f3c67f77.js → index-4b8c01d4.js} +2 -2
- package/dist/_chunks/{index-f3c67f77.js.map → index-4b8c01d4.js.map} +1 -1
- package/dist/_chunks/{index-0bd0d840.mjs → index-4fef292a.mjs} +3 -3
- package/dist/_chunks/{index-0bd0d840.mjs.map → index-4fef292a.mjs.map} +1 -1
- package/dist/_chunks/{index-f67d8e8d.mjs → index-5113c6be.mjs} +2 -2
- package/dist/_chunks/{index-f67d8e8d.mjs.map → index-5113c6be.mjs.map} +1 -1
- package/dist/_chunks/{index-05ada54b.js → index-58ffc071.js} +3 -3
- package/dist/_chunks/{index-05ada54b.js.map → index-58ffc071.js.map} +1 -1
- package/dist/_chunks/{index-c184f4d7.mjs → index-59880344.mjs} +5 -5
- package/dist/_chunks/{index-c184f4d7.mjs.map → index-59880344.mjs.map} +1 -1
- package/dist/_chunks/{index-9c88e73f.js → index-5c19f439.js} +5 -5
- package/dist/_chunks/{index-9c88e73f.js.map → index-5c19f439.js.map} +1 -1
- package/dist/_chunks/{index-b593ff2a.mjs → index-610889c4.mjs} +4 -4
- package/dist/_chunks/{index-b593ff2a.mjs.map → index-610889c4.mjs.map} +1 -1
- package/dist/_chunks/{index-05001647.js → index-628c5937.js} +8 -8
- package/dist/_chunks/{index-05001647.js.map → index-628c5937.js.map} +1 -1
- package/dist/_chunks/{index-2ed87ac8.js → index-64a156de.js} +3 -3
- package/dist/_chunks/{index-2ed87ac8.js.map → index-64a156de.js.map} +1 -1
- package/dist/_chunks/{index-1bf08614.mjs → index-67a35378.mjs} +3 -3
- package/dist/_chunks/{index-1bf08614.mjs.map → index-67a35378.mjs.map} +1 -1
- package/dist/_chunks/{index-3fb94612.js → index-6b1148f6.js} +4 -4
- package/dist/_chunks/{index-3fb94612.js.map → index-6b1148f6.js.map} +1 -1
- package/dist/_chunks/{index-0c5f6415.js → index-6db2b431.js} +5 -5
- package/dist/_chunks/{index-0c5f6415.js.map → index-6db2b431.js.map} +1 -1
- package/dist/_chunks/{index-dff777b7.js → index-6e44aef9.js} +3 -3
- package/dist/_chunks/{index-dff777b7.js.map → index-6e44aef9.js.map} +1 -1
- package/dist/_chunks/{index-a684490c.mjs → index-70189e76.mjs} +3 -3
- package/dist/_chunks/{index-a684490c.mjs.map → index-70189e76.mjs.map} +1 -1
- package/dist/_chunks/{index-7028ad70.js → index-86172b2d.js} +4 -4
- package/dist/_chunks/{index-7028ad70.js.map → index-86172b2d.js.map} +1 -1
- package/dist/_chunks/{index-09752dfe.js → index-898ba1c6.js} +3 -3
- package/dist/_chunks/{index-09752dfe.js.map → index-898ba1c6.js.map} +1 -1
- package/dist/_chunks/{index-c40ee26a.mjs → index-8bca9e4c.mjs} +4 -4
- package/dist/_chunks/{index-c40ee26a.mjs.map → index-8bca9e4c.mjs.map} +1 -1
- package/dist/_chunks/{index-1eaab33f.js → index-8cafda81.js} +4 -4
- package/dist/_chunks/{index-1eaab33f.js.map → index-8cafda81.js.map} +1 -1
- package/dist/_chunks/{index-d5711ebb.js → index-9195720c.js} +5 -5
- package/dist/_chunks/{index-d5711ebb.js.map → index-9195720c.js.map} +1 -1
- package/dist/_chunks/{index-eea1e084.mjs → index-91ef29b3.mjs} +3 -3
- package/dist/_chunks/{index-eea1e084.mjs.map → index-91ef29b3.mjs.map} +1 -1
- package/dist/_chunks/{index-782c0685.mjs → index-994d2c5d.mjs} +2 -2
- package/dist/_chunks/{index-782c0685.mjs.map → index-994d2c5d.mjs.map} +1 -1
- package/dist/_chunks/{index-7a956856.js → index-9deb8ccb.js} +4 -4
- package/dist/_chunks/{index-7a956856.js.map → index-9deb8ccb.js.map} +1 -1
- package/dist/_chunks/{index-cd2af4a0.mjs → index-9eb4c34d.mjs} +5 -5
- package/dist/_chunks/{index-cd2af4a0.mjs.map → index-9eb4c34d.mjs.map} +1 -1
- package/dist/_chunks/{index-de154c58.mjs → index-9f8605e5.mjs} +3 -3
- package/dist/_chunks/{index-de154c58.mjs.map → index-9f8605e5.mjs.map} +1 -1
- package/dist/_chunks/{index-e013fe86.js → index-a0af8beb.js} +3 -3
- package/dist/_chunks/{index-e013fe86.js.map → index-a0af8beb.js.map} +1 -1
- package/dist/_chunks/{index-a220f0b2.mjs → index-aceb13c1.mjs} +4 -4
- package/dist/_chunks/{index-a220f0b2.mjs.map → index-aceb13c1.mjs.map} +1 -1
- package/dist/_chunks/{index-82f22c48.js → index-aee95cda.js} +3 -3
- package/dist/_chunks/{index-82f22c48.js.map → index-aee95cda.js.map} +1 -1
- package/dist/_chunks/{index-55a46be8.mjs → index-b17c7874.mjs} +3 -3
- package/dist/_chunks/{index-55a46be8.mjs.map → index-b17c7874.mjs.map} +1 -1
- package/dist/_chunks/{index-234ed67d.mjs → index-bb22dbbc.mjs} +3 -3
- package/dist/_chunks/{index-234ed67d.mjs.map → index-bb22dbbc.mjs.map} +1 -1
- package/dist/_chunks/{index-b6c497e5.js → index-be02d51c.js} +20 -20
- package/dist/_chunks/{index-b6c497e5.js.map → index-be02d51c.js.map} +1 -1
- package/dist/_chunks/{index-cdc1221a.js → index-be8eb534.js} +3 -3
- package/dist/_chunks/{index-cdc1221a.js.map → index-be8eb534.js.map} +1 -1
- package/dist/_chunks/{index-05f82f02.js → index-c36d6802.js} +3 -3
- package/dist/_chunks/{index-05f82f02.js.map → index-c36d6802.js.map} +1 -1
- package/dist/_chunks/{index-4343f97f.mjs → index-c45d5f19.mjs} +4 -4
- package/dist/_chunks/{index-4343f97f.mjs.map → index-c45d5f19.mjs.map} +1 -1
- package/dist/_chunks/{index-8d895e56.mjs → index-c59a117e.mjs} +3 -3
- package/dist/_chunks/{index-8d895e56.mjs.map → index-c59a117e.mjs.map} +1 -1
- package/dist/_chunks/{index-853bad50.mjs → index-c9e68296.mjs} +5 -5
- package/dist/_chunks/{index-853bad50.mjs.map → index-c9e68296.mjs.map} +1 -1
- package/dist/_chunks/{index-4e8af716.js → index-cd6b99a8.js} +5 -5
- package/dist/_chunks/{index-4e8af716.js.map → index-cd6b99a8.js.map} +1 -1
- package/dist/_chunks/{index-326b9481.mjs → index-ce41b6f0.mjs} +4 -4
- package/dist/_chunks/{index-326b9481.mjs.map → index-ce41b6f0.mjs.map} +1 -1
- package/dist/_chunks/{index-8acbbabe.js → index-d3dea80c.js} +6 -6
- package/dist/_chunks/{index-8acbbabe.js.map → index-d3dea80c.js.map} +1 -1
- package/dist/_chunks/{index-706ae836.js → index-d63b0b91.js} +4 -4
- package/dist/_chunks/{index-706ae836.js.map → index-d63b0b91.js.map} +1 -1
- package/dist/_chunks/{index-77124563.mjs → index-dc4938ad.mjs} +5 -5
- package/dist/_chunks/{index-77124563.mjs.map → index-dc4938ad.mjs.map} +1 -1
- package/dist/_chunks/{index-c075b5a1.mjs → index-dc89c18c.mjs} +335 -277
- package/dist/_chunks/index-dc89c18c.mjs.map +1 -0
- package/dist/_chunks/{index-f0f40db4.mjs → index-ea43b165.mjs} +5 -5
- package/dist/_chunks/{index-f0f40db4.mjs.map → index-ea43b165.mjs.map} +1 -1
- package/dist/_chunks/{index-55d6d65a.js → index-eb59cabf.js} +3 -3
- package/dist/_chunks/{index-55d6d65a.js.map → index-eb59cabf.js.map} +1 -1
- package/dist/_chunks/{index-d9f9de85.mjs → index-fae4b277.mjs} +4 -4
- package/dist/_chunks/{index-d9f9de85.mjs.map → index-fae4b277.mjs.map} +1 -1
- package/dist/_chunks/{index-96af3a65.js → index-ff9d30ef.js} +5 -5
- package/dist/_chunks/{index-96af3a65.js.map → index-ff9d30ef.js.map} +1 -1
- package/dist/_chunks/{schema-82ad2cb1.mjs → schema-549f8236.mjs} +2 -2
- package/dist/_chunks/{schema-82ad2cb1.mjs.map → schema-549f8236.mjs.map} +1 -1
- package/dist/_chunks/{schema-8bb5b01b.js → schema-e3080441.js} +2 -2
- package/dist/_chunks/{schema-8bb5b01b.js.map → schema-e3080441.js.map} +1 -1
- package/dist/_chunks/{validateWorkflow-23b1ee38.mjs → validateWorkflow-7bff41ac.mjs} +3 -3
- package/dist/_chunks/{validateWorkflow-23b1ee38.mjs.map → validateWorkflow-7bff41ac.mjs.map} +1 -1
- package/dist/_chunks/{validateWorkflow-f5761727.js → validateWorkflow-a7311af1.js} +3 -3
- package/dist/_chunks/{validateWorkflow-f5761727.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-62b7bdbe.js.map +0 -1
- package/dist/_chunks/index-c075b5a1.mjs.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;
|
|
@@ -286,7 +545,7 @@ const DefaultDocument = () => {
|
|
|
286
545
|
};
|
|
287
546
|
const getEntryModule = (ctx) => {
|
|
288
547
|
const pluginsObject = ctx.plugins.map(({ name, importName }) => `'${name}': ${importName}`).join(",\n");
|
|
289
|
-
const pluginsImport = ctx.plugins.map(({ importName,
|
|
548
|
+
const pluginsImport = ctx.plugins.map(({ importName, modulePath }) => `import ${importName} from '${modulePath}';`).join("\n");
|
|
290
549
|
return outdent`
|
|
291
550
|
/**
|
|
292
551
|
* This file was automatically generated by Strapi.
|
|
@@ -295,15 +554,12 @@ const getEntryModule = (ctx) => {
|
|
|
295
554
|
${pluginsImport}
|
|
296
555
|
import { renderAdmin } from "@strapi/strapi/admin"
|
|
297
556
|
|
|
298
|
-
${ctx.customisations?.
|
|
299
|
-
ctx.runtimeDir,
|
|
300
|
-
ctx.customisations.path
|
|
301
|
-
)}'` : ""}
|
|
557
|
+
${ctx.customisations?.modulePath ? `import customisations from '${ctx.customisations.modulePath}'` : ""}
|
|
302
558
|
|
|
303
559
|
renderAdmin(
|
|
304
560
|
document.getElementById("strapi"),
|
|
305
561
|
{
|
|
306
|
-
${ctx.customisations?.
|
|
562
|
+
${ctx.customisations?.modulePath ? "customisations," : ""}
|
|
307
563
|
plugins: {
|
|
308
564
|
${pluginsObject}
|
|
309
565
|
}
|
|
@@ -418,27 +674,6 @@ async function loadStrapiMonorepo(cwd) {
|
|
|
418
674
|
}
|
|
419
675
|
return void 0;
|
|
420
676
|
}
|
|
421
|
-
const pathExists = async (path2) => {
|
|
422
|
-
try {
|
|
423
|
-
await access(path2);
|
|
424
|
-
return true;
|
|
425
|
-
} catch (error) {
|
|
426
|
-
return false;
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
|
-
const loadFile = async (path2) => {
|
|
430
|
-
if (await pathExists(path2)) {
|
|
431
|
-
const esbuildOptions = {
|
|
432
|
-
extensions: [".js", ".mjs", ".ts"]
|
|
433
|
-
};
|
|
434
|
-
const { unregister } = register(esbuildOptions);
|
|
435
|
-
const mod = require(path2);
|
|
436
|
-
unregister();
|
|
437
|
-
const file = mod?.default || mod || void 0;
|
|
438
|
-
return file;
|
|
439
|
-
}
|
|
440
|
-
return void 0;
|
|
441
|
-
};
|
|
442
677
|
const resolveBaseConfig = async (ctx) => {
|
|
443
678
|
const monorepo = await loadStrapiMonorepo(ctx.cwd);
|
|
444
679
|
const target = browserslistToEsbuild(ctx.target);
|
|
@@ -641,27 +876,6 @@ const mergeConfigWithUserConfig = async (config, ctx) => {
|
|
|
641
876
|
}
|
|
642
877
|
return config;
|
|
643
878
|
};
|
|
644
|
-
const isError = (err) => err instanceof Error;
|
|
645
|
-
const handleUnexpectedError = (err) => {
|
|
646
|
-
console.error(
|
|
647
|
-
chalk.red(
|
|
648
|
-
`[ERROR] `,
|
|
649
|
-
"There seems to be an unexpected error, try again with --debug for more information",
|
|
650
|
-
os.EOL
|
|
651
|
-
)
|
|
652
|
-
);
|
|
653
|
-
if (isError(err) && err.stack) {
|
|
654
|
-
console.log(
|
|
655
|
-
chalk.red(
|
|
656
|
-
boxen(err.stack, {
|
|
657
|
-
padding: 1,
|
|
658
|
-
align: "left"
|
|
659
|
-
})
|
|
660
|
-
)
|
|
661
|
-
);
|
|
662
|
-
}
|
|
663
|
-
process.exit(1);
|
|
664
|
-
};
|
|
665
879
|
const build$1 = async (ctx) => new Promise(async (resolve, reject) => {
|
|
666
880
|
const config = await resolveProductionConfig(ctx);
|
|
667
881
|
const finalConfig = await mergeConfigWithUserConfig(config, ctx);
|
|
@@ -692,205 +906,6 @@ const build$1 = async (ctx) => new Promise(async (resolve, reject) => {
|
|
|
692
906
|
}
|
|
693
907
|
});
|
|
694
908
|
});
|
|
695
|
-
const loadEnv = async (cwd) => {
|
|
696
|
-
const pathToEnv = path.resolve(cwd, ".env");
|
|
697
|
-
if (await pathExists(pathToEnv)) {
|
|
698
|
-
dotenv.config({ path: pathToEnv });
|
|
699
|
-
}
|
|
700
|
-
};
|
|
701
|
-
const getStrapiAdminEnvVars = (defaultEnv) => {
|
|
702
|
-
return Object.keys(process.env).filter((key) => key.toUpperCase().startsWith("STRAPI_ADMIN_")).reduce((acc, key) => {
|
|
703
|
-
acc[key] = process.env[key];
|
|
704
|
-
return acc;
|
|
705
|
-
}, defaultEnv);
|
|
706
|
-
};
|
|
707
|
-
const validatePackageHasStrapi = (pkg) => "strapi" in pkg && typeof pkg.strapi === "object" && !Array.isArray(pkg.strapi) && pkg.strapi !== null;
|
|
708
|
-
const validatePackageIsPlugin = (pkg) => validatePackageHasStrapi(pkg) && pkg.strapi.kind === "plugin";
|
|
709
|
-
const getEnabledPlugins = async ({
|
|
710
|
-
strapi,
|
|
711
|
-
cwd,
|
|
712
|
-
logger
|
|
713
|
-
}) => {
|
|
714
|
-
const plugins = {};
|
|
715
|
-
const deps = strapi.config.get("info.dependencies", {});
|
|
716
|
-
logger.debug("Dependencies from user's project", os.EOL, deps);
|
|
717
|
-
for (const dep of Object.keys(deps)) {
|
|
718
|
-
const pkg = await getModule(dep, cwd);
|
|
719
|
-
if (pkg && validatePackageIsPlugin(pkg)) {
|
|
720
|
-
const name = pkg.strapi.name || pkg.name;
|
|
721
|
-
if (!name) {
|
|
722
|
-
throw Error(
|
|
723
|
-
"You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!"
|
|
724
|
-
);
|
|
725
|
-
}
|
|
726
|
-
plugins[name] = {
|
|
727
|
-
name,
|
|
728
|
-
pathToPlugin: dep
|
|
729
|
-
};
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);
|
|
733
|
-
logger.debug("User's plugins file", os.EOL, userPluginsFile);
|
|
734
|
-
for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)) {
|
|
735
|
-
if (userPluginConfig.enabled && userPluginConfig.resolve) {
|
|
736
|
-
plugins[userPluginName] = {
|
|
737
|
-
name: userPluginName,
|
|
738
|
-
isLocal: true,
|
|
739
|
-
/**
|
|
740
|
-
* User plugin paths are resolved from the entry point
|
|
741
|
-
* of the app, because that's how you import them.
|
|
742
|
-
*/
|
|
743
|
-
pathToPlugin: userPluginConfig.resolve
|
|
744
|
-
};
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
return plugins;
|
|
748
|
-
};
|
|
749
|
-
const PLUGIN_CONFIGS = ["plugins.js", "plugins.mjs", "plugins.ts"];
|
|
750
|
-
const loadUserPluginsFile = async (root) => {
|
|
751
|
-
for (const file of PLUGIN_CONFIGS) {
|
|
752
|
-
const filePath = path.join(root, file);
|
|
753
|
-
const configFile = await loadFile(filePath);
|
|
754
|
-
if (configFile) {
|
|
755
|
-
return typeof configFile === "function" ? configFile({ env }) : configFile;
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
return {};
|
|
759
|
-
};
|
|
760
|
-
const getMapOfPluginsWithAdmin = (plugins, { runtimeDir }) => Object.values(plugins).filter((plugin) => {
|
|
761
|
-
if (!plugin) {
|
|
762
|
-
return false;
|
|
763
|
-
}
|
|
764
|
-
try {
|
|
765
|
-
const isLocalPluginWithLegacyAdminFile = fs$1.existsSync(
|
|
766
|
-
//@ts-ignore
|
|
767
|
-
path.resolve(`${plugin.pathToPlugin}/strapi-admin.js`)
|
|
768
|
-
);
|
|
769
|
-
if (!isLocalPluginWithLegacyAdminFile) {
|
|
770
|
-
let pathToPlugin = plugin.pathToPlugin;
|
|
771
|
-
if (process.platform === "win32") {
|
|
772
|
-
pathToPlugin = pathToPlugin.split(path.sep).join(path.posix.sep);
|
|
773
|
-
}
|
|
774
|
-
const isModuleWithFE = require.resolve(`${pathToPlugin}/strapi-admin`);
|
|
775
|
-
return isModuleWithFE;
|
|
776
|
-
}
|
|
777
|
-
return isLocalPluginWithLegacyAdminFile;
|
|
778
|
-
} catch (err) {
|
|
779
|
-
if (isError(err) && "code" in err && err.code === "MODULE_NOT_FOUND") {
|
|
780
|
-
return false;
|
|
781
|
-
}
|
|
782
|
-
throw err;
|
|
783
|
-
}
|
|
784
|
-
}).map((plugin) => {
|
|
785
|
-
const systemPath = plugin.isLocal ? path.relative(runtimeDir, plugin.pathToPlugin.split("/").join(path.sep)) : void 0;
|
|
786
|
-
const modulePath = systemPath ? systemPath.split(path.sep).join("/") : void 0;
|
|
787
|
-
return {
|
|
788
|
-
path: !plugin.isLocal ? `${plugin.pathToPlugin}/strapi-admin` : `${modulePath}/strapi-admin`,
|
|
789
|
-
name: plugin.name,
|
|
790
|
-
importName: camelCase(plugin.name)
|
|
791
|
-
};
|
|
792
|
-
});
|
|
793
|
-
const ADMIN_APP_FILES = ["app.js", "app.mjs", "app.ts", "app.jsx", "app.tsx"];
|
|
794
|
-
const loadUserAppFile = async (appDir) => {
|
|
795
|
-
for (const file of ADMIN_APP_FILES) {
|
|
796
|
-
const filePath = path.join(appDir, "src", "admin", file);
|
|
797
|
-
if (fs$1.existsSync(filePath)) {
|
|
798
|
-
return { path: filePath };
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
return void 0;
|
|
802
|
-
};
|
|
803
|
-
const DEFAULT_BROWSERSLIST = [
|
|
804
|
-
"last 3 major versions",
|
|
805
|
-
"Firefox ESR",
|
|
806
|
-
"last 2 Opera versions",
|
|
807
|
-
"not dead"
|
|
808
|
-
];
|
|
809
|
-
const createBuildContext = async ({
|
|
810
|
-
cwd,
|
|
811
|
-
logger,
|
|
812
|
-
tsconfig,
|
|
813
|
-
strapi,
|
|
814
|
-
options = {}
|
|
815
|
-
}) => {
|
|
816
|
-
const strapiInstance = strapi ?? strapiFactory({
|
|
817
|
-
// Directories
|
|
818
|
-
appDir: cwd,
|
|
819
|
-
distDir: tsconfig?.config.options.outDir ?? "",
|
|
820
|
-
// Options
|
|
821
|
-
autoReload: true,
|
|
822
|
-
serveAdminPanel: false
|
|
823
|
-
});
|
|
824
|
-
const { serverUrl, adminPath } = getConfigUrls(strapiInstance.config, true);
|
|
825
|
-
await loadEnv(cwd);
|
|
826
|
-
const env2 = getStrapiAdminEnvVars({
|
|
827
|
-
ADMIN_PATH: adminPath,
|
|
828
|
-
STRAPI_ADMIN_BACKEND_URL: serverUrl,
|
|
829
|
-
STRAPI_TELEMETRY_DISABLED: String(strapiInstance.telemetry.isDisabled)
|
|
830
|
-
});
|
|
831
|
-
const envKeys = Object.keys(env2);
|
|
832
|
-
if (envKeys.length > 0) {
|
|
833
|
-
logger.info(
|
|
834
|
-
[
|
|
835
|
-
"Including the following ENV variables as part of the JS bundle:",
|
|
836
|
-
...envKeys.map((key) => ` - ${key}`)
|
|
837
|
-
].join(os.EOL)
|
|
838
|
-
);
|
|
839
|
-
}
|
|
840
|
-
const distPath = path.join(strapiInstance.dirs.dist.root, "build");
|
|
841
|
-
const distDir = path.relative(cwd, distPath);
|
|
842
|
-
try {
|
|
843
|
-
logger.debug(`Cleaning dist folder: ${distPath}`);
|
|
844
|
-
await fs.rm(distPath, { recursive: true, force: true });
|
|
845
|
-
logger.debug("Cleaned dist folder");
|
|
846
|
-
} catch {
|
|
847
|
-
logger.debug("There was no dist folder to clean");
|
|
848
|
-
}
|
|
849
|
-
const runtimeDir = path.join(cwd, ".strapi", "client");
|
|
850
|
-
const entry = path.relative(cwd, path.join(runtimeDir, "app.js"));
|
|
851
|
-
const plugins = await getEnabledPlugins({ cwd, logger, strapi: strapiInstance });
|
|
852
|
-
logger.debug("Enabled plugins", os.EOL, plugins);
|
|
853
|
-
const pluginsWithFront = getMapOfPluginsWithAdmin(plugins, { runtimeDir });
|
|
854
|
-
logger.debug("Enabled plugins with FE", os.EOL, plugins);
|
|
855
|
-
const target = browserslist.loadConfig({ path: cwd }) ?? DEFAULT_BROWSERSLIST;
|
|
856
|
-
const customisations = await loadUserAppFile(strapiInstance.dirs.app.root);
|
|
857
|
-
const buildContext = {
|
|
858
|
-
appDir: strapiInstance.dirs.app.root,
|
|
859
|
-
basePath: `${adminPath}/`,
|
|
860
|
-
customisations,
|
|
861
|
-
cwd,
|
|
862
|
-
distDir,
|
|
863
|
-
distPath,
|
|
864
|
-
entry,
|
|
865
|
-
env: env2,
|
|
866
|
-
logger,
|
|
867
|
-
options,
|
|
868
|
-
plugins: pluginsWithFront,
|
|
869
|
-
runtimeDir,
|
|
870
|
-
strapi: strapiInstance,
|
|
871
|
-
target,
|
|
872
|
-
tsconfig
|
|
873
|
-
};
|
|
874
|
-
return buildContext;
|
|
875
|
-
};
|
|
876
|
-
function getTimer() {
|
|
877
|
-
const timings = {};
|
|
878
|
-
const startTimes = {};
|
|
879
|
-
function start(name) {
|
|
880
|
-
if (typeof startTimes[name] !== "undefined") {
|
|
881
|
-
throw new Error(`Timer "${name}" already started, cannot overwrite`);
|
|
882
|
-
}
|
|
883
|
-
startTimes[name] = performance.now();
|
|
884
|
-
}
|
|
885
|
-
function end(name) {
|
|
886
|
-
if (typeof startTimes[name] === "undefined") {
|
|
887
|
-
throw new Error(`Timer "${name}" never started, cannot end`);
|
|
888
|
-
}
|
|
889
|
-
timings[name] = performance.now() - startTimes[name];
|
|
890
|
-
return timings[name];
|
|
891
|
-
}
|
|
892
|
-
return { start, end, getTimings: () => timings };
|
|
893
|
-
}
|
|
894
909
|
const build = async ({ logger, cwd, tsconfig, ignorePrompts, ...options }) => {
|
|
895
910
|
const timer = getTimer();
|
|
896
911
|
const { didInstall } = await checkRequiredDependencies({ cwd, logger, ignorePrompts }).catch(
|
|
@@ -907,7 +922,7 @@ const build = async ({ logger, cwd, tsconfig, ignorePrompts, ...options }) => {
|
|
|
907
922
|
const compilingTsSpinner = logger.spinner(`Compiling TS`).start();
|
|
908
923
|
tsUtils.compile(cwd, { configOptions: { ignoreDiagnostics: false } });
|
|
909
924
|
const compilingDuration = timer.end("compilingTS");
|
|
910
|
-
compilingTsSpinner.text = `Compiling TS (${compilingDuration}
|
|
925
|
+
compilingTsSpinner.text = `Compiling TS (${prettyTime(compilingDuration)})`;
|
|
911
926
|
compilingTsSpinner.succeed();
|
|
912
927
|
}
|
|
913
928
|
timer.start("createBuildContext");
|
|
@@ -920,7 +935,7 @@ const build = async ({ logger, cwd, tsconfig, ignorePrompts, ...options }) => {
|
|
|
920
935
|
options
|
|
921
936
|
});
|
|
922
937
|
const contextDuration = timer.end("createBuildContext");
|
|
923
|
-
contextSpinner.text = `Building build context (${contextDuration}
|
|
938
|
+
contextSpinner.text = `Building build context (${prettyTime(contextDuration)})`;
|
|
924
939
|
contextSpinner.succeed();
|
|
925
940
|
timer.start("buildAdmin");
|
|
926
941
|
const buildingSpinner = logger.spinner(`Building admin panel`).start();
|
|
@@ -930,7 +945,7 @@ const build = async ({ logger, cwd, tsconfig, ignorePrompts, ...options }) => {
|
|
|
930
945
|
await writeStaticClientFiles(ctx);
|
|
931
946
|
await build$1(ctx);
|
|
932
947
|
const buildDuration = timer.end("buildAdmin");
|
|
933
|
-
buildingSpinner.text = `Building admin panel (${buildDuration}
|
|
948
|
+
buildingSpinner.text = `Building admin panel (${prettyTime(buildDuration)})`;
|
|
934
949
|
buildingSpinner.succeed();
|
|
935
950
|
} catch (err) {
|
|
936
951
|
buildingSpinner.fail();
|
|
@@ -1018,6 +1033,35 @@ const watch = async (ctx) => {
|
|
|
1018
1033
|
});
|
|
1019
1034
|
});
|
|
1020
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
|
+
};
|
|
1021
1065
|
const develop = async ({
|
|
1022
1066
|
cwd,
|
|
1023
1067
|
polling,
|
|
@@ -1038,6 +1082,10 @@ const develop = async ({
|
|
|
1038
1082
|
if (didInstall) {
|
|
1039
1083
|
return;
|
|
1040
1084
|
}
|
|
1085
|
+
if (tsconfig?.config) {
|
|
1086
|
+
await cleanupDistDirectory({ tsconfig, logger, timer });
|
|
1087
|
+
await tsUtils.compile(cwd, { configOptions: { ignoreDiagnostics: true } });
|
|
1088
|
+
}
|
|
1041
1089
|
if (!watchAdmin) {
|
|
1042
1090
|
timer.start("createBuildContext");
|
|
1043
1091
|
const contextSpinner = logger.spinner(`Building build context`).start();
|
|
@@ -1049,7 +1097,7 @@ const develop = async ({
|
|
|
1049
1097
|
options
|
|
1050
1098
|
});
|
|
1051
1099
|
const contextDuration = timer.end("createBuildContext");
|
|
1052
|
-
contextSpinner.text = `Building build context (${contextDuration}
|
|
1100
|
+
contextSpinner.text = `Building build context (${prettyTime(contextDuration)})`;
|
|
1053
1101
|
contextSpinner.succeed();
|
|
1054
1102
|
timer.start("creatingAdmin");
|
|
1055
1103
|
const adminSpinner = logger.spinner(`Creating admin`).start();
|
|
@@ -1057,12 +1105,16 @@ const develop = async ({
|
|
|
1057
1105
|
await writeStaticClientFiles(ctx);
|
|
1058
1106
|
await build$1(ctx);
|
|
1059
1107
|
const adminDuration = timer.end("creatingAdmin");
|
|
1060
|
-
adminSpinner.text = `Creating admin (${adminDuration}
|
|
1108
|
+
adminSpinner.text = `Creating admin (${prettyTime(adminDuration)})`;
|
|
1061
1109
|
adminSpinner.succeed();
|
|
1062
1110
|
}
|
|
1063
1111
|
cluster.on("message", async (worker, message) => {
|
|
1064
1112
|
switch (message) {
|
|
1065
1113
|
case "reload": {
|
|
1114
|
+
if (tsconfig?.config) {
|
|
1115
|
+
await cleanupDistDirectory({ tsconfig, logger, timer });
|
|
1116
|
+
await tsUtils.compile(cwd, { configOptions: { ignoreDiagnostics: true } });
|
|
1117
|
+
}
|
|
1066
1118
|
logger.debug("cluster has the reload message, sending the worker kill message");
|
|
1067
1119
|
worker.send("kill");
|
|
1068
1120
|
break;
|
|
@@ -1081,14 +1133,8 @@ const develop = async ({
|
|
|
1081
1133
|
cluster.fork();
|
|
1082
1134
|
}
|
|
1083
1135
|
if (cluster.isWorker) {
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
const compilingTsSpinner = logger.spinner(`Compiling TS`).start();
|
|
1087
|
-
tsUtils.compile(cwd, { configOptions: { ignoreDiagnostics: false } });
|
|
1088
|
-
const compilingDuration = timer.end("compilingTS");
|
|
1089
|
-
compilingTsSpinner.text = `Compiling TS (${compilingDuration}ms)`;
|
|
1090
|
-
compilingTsSpinner.succeed();
|
|
1091
|
-
}
|
|
1136
|
+
timer.start("loadStrapi");
|
|
1137
|
+
const loadStrapiSpinner = logger.spinner(`Loading Strapi`).start();
|
|
1092
1138
|
const strapi = strapiFactory({
|
|
1093
1139
|
appDir: cwd,
|
|
1094
1140
|
distDir: tsconfig?.config.options.outDir ?? "",
|
|
@@ -1108,7 +1154,7 @@ const develop = async ({
|
|
|
1108
1154
|
options
|
|
1109
1155
|
});
|
|
1110
1156
|
const contextDuration = timer.end("createBuildContext");
|
|
1111
|
-
contextSpinner.text = `Building build context (${contextDuration}
|
|
1157
|
+
contextSpinner.text = `Building build context (${prettyTime(contextDuration)})`;
|
|
1112
1158
|
contextSpinner.succeed();
|
|
1113
1159
|
timer.start("creatingAdmin");
|
|
1114
1160
|
const adminSpinner = logger.spinner(`Creating admin`).start();
|
|
@@ -1116,10 +1162,13 @@ const develop = async ({
|
|
|
1116
1162
|
await writeStaticClientFiles(ctx);
|
|
1117
1163
|
webpackWatcher = await watch(ctx);
|
|
1118
1164
|
const adminDuration = timer.end("creatingAdmin");
|
|
1119
|
-
adminSpinner.text = `Creating admin (${adminDuration}
|
|
1165
|
+
adminSpinner.text = `Creating admin (${prettyTime(adminDuration)})`;
|
|
1120
1166
|
adminSpinner.succeed();
|
|
1121
1167
|
}
|
|
1122
1168
|
const strapiInstance = await strapi.load();
|
|
1169
|
+
const loadStrapiDuration = timer.end("loadStrapi");
|
|
1170
|
+
loadStrapiSpinner.text = `Loading Strapi (${prettyTime(loadStrapiDuration)})`;
|
|
1171
|
+
loadStrapiSpinner.succeed();
|
|
1123
1172
|
timer.start("generatingTS");
|
|
1124
1173
|
const generatingTsSpinner = logger.spinner(`Generating types`).start();
|
|
1125
1174
|
await tsUtils.generators.generate({
|
|
@@ -1130,8 +1179,17 @@ const develop = async ({
|
|
|
1130
1179
|
artifacts: { contentTypes: true, components: true }
|
|
1131
1180
|
});
|
|
1132
1181
|
const generatingDuration = timer.end("generatingTS");
|
|
1133
|
-
generatingTsSpinner.text = `Generating types (${generatingDuration}
|
|
1182
|
+
generatingTsSpinner.text = `Generating types (${prettyTime(generatingDuration)})`;
|
|
1134
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
|
+
}
|
|
1135
1193
|
const restart = async () => {
|
|
1136
1194
|
if (strapiInstance.reload.isWatching && !strapiInstance.reload.isReloading) {
|
|
1137
1195
|
strapiInstance.reload.isReloading = true;
|
|
@@ -1201,4 +1259,4 @@ export {
|
|
|
1201
1259
|
handleUnexpectedError as h,
|
|
1202
1260
|
index as i
|
|
1203
1261
|
};
|
|
1204
|
-
//# sourceMappingURL=index-
|
|
1262
|
+
//# sourceMappingURL=index-dc89c18c.mjs.map
|