@strapi/strapi 5.9.0 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin-test.js +11 -8
- package/dist/admin-test.js.map +1 -1
- package/dist/admin-test.mjs +1 -1
- package/dist/admin-test.mjs.map +1 -1
- package/dist/admin.js +36 -42
- package/dist/admin.js.map +1 -1
- package/dist/admin.mjs +28 -35
- package/dist/admin.mjs.map +1 -1
- package/dist/chunks/aliases-Ca20Yntz.js +80 -0
- package/dist/chunks/aliases-Ca20Yntz.js.map +1 -0
- package/dist/chunks/aliases-DQ51KexN.mjs +76 -0
- package/dist/chunks/aliases-DQ51KexN.mjs.map +1 -0
- package/dist/chunks/build-3I6A92J1.js +59 -0
- package/dist/chunks/build-3I6A92J1.js.map +1 -0
- package/dist/chunks/build-BqigoS45.mjs +85 -0
- package/dist/chunks/build-BqigoS45.mjs.map +1 -0
- package/dist/chunks/build-CWUlYFQo.js +87 -0
- package/dist/chunks/build-CWUlYFQo.js.map +1 -0
- package/dist/chunks/build-gBR43Dth.mjs +57 -0
- package/dist/chunks/build-gBR43Dth.mjs.map +1 -0
- package/dist/chunks/config-5tFWkbOi.js +154 -0
- package/dist/chunks/config-5tFWkbOi.js.map +1 -0
- package/dist/chunks/config-BSlsDIVc.mjs +243 -0
- package/dist/chunks/config-BSlsDIVc.mjs.map +1 -0
- package/dist/chunks/config-CLeubzgx.mjs +150 -0
- package/dist/chunks/config-CLeubzgx.mjs.map +1 -0
- package/dist/chunks/config-CQ94iNYq.js +247 -0
- package/dist/chunks/config-CQ94iNYq.js.map +1 -0
- package/dist/chunks/index-DtHH3PFG.mjs +3160 -0
- package/dist/chunks/index-DtHH3PFG.mjs.map +1 -0
- package/dist/chunks/index-kv_K5f7_.js +3185 -0
- package/dist/chunks/index-kv_K5f7_.js.map +1 -0
- package/dist/chunks/watch-B7qfL21s.js +146 -0
- package/dist/chunks/watch-B7qfL21s.js.map +1 -0
- package/dist/chunks/watch-BBDpuCFC.js +133 -0
- package/dist/chunks/watch-BBDpuCFC.js.map +1 -0
- package/dist/chunks/watch-Bhd-75O5.mjs +131 -0
- package/dist/chunks/watch-Bhd-75O5.mjs.map +1 -0
- package/dist/chunks/watch-CJr1UoWF.mjs +144 -0
- package/dist/chunks/watch-CJr1UoWF.mjs.map +1 -0
- package/dist/cli/commands/plugin/init/files/typescript.d.ts +20 -7
- package/dist/cli/commands/plugin/init/files/typescript.d.ts.map +1 -1
- package/dist/cli/commands/version.d.ts.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli.js +50 -0
- package/dist/cli.js.map +1 -0
- package/dist/cli.mjs +43 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/node/core/errors.d.ts.map +1 -1
- package/dist/node/create-build-context.d.ts +1 -1
- package/dist/node/create-build-context.d.ts.map +1 -1
- package/package.json +26 -26
- package/dist/cli/commands/admin/create-user.js +0 -91
- package/dist/cli/commands/admin/create-user.js.map +0 -1
- package/dist/cli/commands/admin/create-user.mjs +0 -88
- package/dist/cli/commands/admin/create-user.mjs.map +0 -1
- package/dist/cli/commands/admin/reset-user-password.js +0 -47
- package/dist/cli/commands/admin/reset-user-password.js.map +0 -1
- package/dist/cli/commands/admin/reset-user-password.mjs +0 -44
- package/dist/cli/commands/admin/reset-user-password.mjs.map +0 -1
- package/dist/cli/commands/build.js +0 -24
- package/dist/cli/commands/build.js.map +0 -1
- package/dist/cli/commands/build.mjs +0 -24
- package/dist/cli/commands/build.mjs.map +0 -1
- package/dist/cli/commands/components/list.js +0 -27
- package/dist/cli/commands/components/list.js.map +0 -1
- package/dist/cli/commands/components/list.mjs +0 -24
- package/dist/cli/commands/components/list.mjs.map +0 -1
- package/dist/cli/commands/configuration/dump.js +0 -43
- package/dist/cli/commands/configuration/dump.js.map +0 -1
- package/dist/cli/commands/configuration/dump.mjs +0 -41
- package/dist/cli/commands/configuration/dump.mjs.map +0 -1
- package/dist/cli/commands/configuration/restore.js +0 -142
- package/dist/cli/commands/configuration/restore.js.map +0 -1
- package/dist/cli/commands/configuration/restore.mjs +0 -139
- package/dist/cli/commands/configuration/restore.mjs.map +0 -1
- package/dist/cli/commands/console.js +0 -29
- package/dist/cli/commands/console.js.map +0 -1
- package/dist/cli/commands/console.mjs +0 -27
- package/dist/cli/commands/console.mjs.map +0 -1
- package/dist/cli/commands/content-types/list.js +0 -27
- package/dist/cli/commands/content-types/list.js.map +0 -1
- package/dist/cli/commands/content-types/list.mjs +0 -24
- package/dist/cli/commands/content-types/list.mjs.map +0 -1
- package/dist/cli/commands/controllers/list.js +0 -27
- package/dist/cli/commands/controllers/list.js.map +0 -1
- package/dist/cli/commands/controllers/list.mjs +0 -24
- package/dist/cli/commands/controllers/list.mjs.map +0 -1
- package/dist/cli/commands/develop.js +0 -29
- package/dist/cli/commands/develop.js.map +0 -1
- package/dist/cli/commands/develop.mjs +0 -27
- package/dist/cli/commands/develop.mjs.map +0 -1
- package/dist/cli/commands/export/action.js +0 -118
- package/dist/cli/commands/export/action.js.map +0 -1
- package/dist/cli/commands/export/action.mjs +0 -116
- package/dist/cli/commands/export/action.mjs.map +0 -1
- package/dist/cli/commands/export/command.js +0 -23
- package/dist/cli/commands/export/command.js.map +0 -1
- package/dist/cli/commands/export/command.mjs +0 -24
- package/dist/cli/commands/export/command.mjs.map +0 -1
- package/dist/cli/commands/generate.js +0 -35
- package/dist/cli/commands/generate.js.map +0 -1
- package/dist/cli/commands/generate.mjs +0 -13
- package/dist/cli/commands/generate.mjs.map +0 -1
- package/dist/cli/commands/hooks/list.js +0 -27
- package/dist/cli/commands/hooks/list.js.map +0 -1
- package/dist/cli/commands/hooks/list.mjs +0 -24
- package/dist/cli/commands/hooks/list.mjs.map +0 -1
- package/dist/cli/commands/import/action.js +0 -106
- package/dist/cli/commands/import/action.js.map +0 -1
- package/dist/cli/commands/import/action.mjs +0 -105
- package/dist/cli/commands/import/action.mjs.map +0 -1
- package/dist/cli/commands/import/command.js +0 -70
- package/dist/cli/commands/import/command.js.map +0 -1
- package/dist/cli/commands/import/command.mjs +0 -68
- package/dist/cli/commands/import/command.mjs.map +0 -1
- package/dist/cli/commands/index.js +0 -63
- package/dist/cli/commands/index.js.map +0 -1
- package/dist/cli/commands/index.mjs +0 -63
- package/dist/cli/commands/index.mjs.map +0 -1
- package/dist/cli/commands/middlewares/list.js +0 -27
- package/dist/cli/commands/middlewares/list.js.map +0 -1
- package/dist/cli/commands/middlewares/list.mjs +0 -24
- package/dist/cli/commands/middlewares/list.mjs.map +0 -1
- package/dist/cli/commands/policies/list.js +0 -27
- package/dist/cli/commands/policies/list.js.map +0 -1
- package/dist/cli/commands/policies/list.mjs +0 -24
- package/dist/cli/commands/policies/list.mjs.map +0 -1
- package/dist/cli/commands/report.js +0 -35
- package/dist/cli/commands/report.js.map +0 -1
- package/dist/cli/commands/report.mjs +0 -35
- package/dist/cli/commands/report.mjs.map +0 -1
- package/dist/cli/commands/routes/list.js +0 -31
- package/dist/cli/commands/routes/list.js.map +0 -1
- package/dist/cli/commands/routes/list.mjs +0 -28
- package/dist/cli/commands/routes/list.mjs.map +0 -1
- package/dist/cli/commands/services/list.js +0 -27
- package/dist/cli/commands/services/list.js.map +0 -1
- package/dist/cli/commands/services/list.mjs +0 -24
- package/dist/cli/commands/services/list.mjs.map +0 -1
- package/dist/cli/commands/start.js +0 -27
- package/dist/cli/commands/start.js.map +0 -1
- package/dist/cli/commands/start.mjs +0 -24
- package/dist/cli/commands/start.mjs.map +0 -1
- package/dist/cli/commands/telemetry/disable.js +0 -70
- package/dist/cli/commands/telemetry/disable.js.map +0 -1
- package/dist/cli/commands/telemetry/disable.mjs +0 -67
- package/dist/cli/commands/telemetry/disable.mjs.map +0 -1
- package/dist/cli/commands/telemetry/enable.js +0 -89
- package/dist/cli/commands/telemetry/enable.js.map +0 -1
- package/dist/cli/commands/telemetry/enable.mjs +0 -86
- package/dist/cli/commands/telemetry/enable.mjs.map +0 -1
- package/dist/cli/commands/templates/generate.js +0 -11
- package/dist/cli/commands/templates/generate.js.map +0 -1
- package/dist/cli/commands/templates/generate.mjs +0 -11
- package/dist/cli/commands/templates/generate.mjs.map +0 -1
- package/dist/cli/commands/transfer/action.js +0 -130
- package/dist/cli/commands/transfer/action.js.map +0 -1
- package/dist/cli/commands/transfer/action.mjs +0 -131
- package/dist/cli/commands/transfer/action.mjs.map +0 -1
- package/dist/cli/commands/transfer/command.js +0 -85
- package/dist/cli/commands/transfer/command.js.map +0 -1
- package/dist/cli/commands/transfer/command.mjs +0 -84
- package/dist/cli/commands/transfer/command.mjs.map +0 -1
- package/dist/cli/commands/ts/generate-types.js +0 -36
- package/dist/cli/commands/ts/generate-types.js.map +0 -1
- package/dist/cli/commands/ts/generate-types.mjs +0 -34
- package/dist/cli/commands/ts/generate-types.mjs.map +0 -1
- package/dist/cli/commands/version.js +0 -13
- package/dist/cli/commands/version.js.map +0 -1
- package/dist/cli/commands/version.mjs +0 -13
- package/dist/cli/commands/version.mjs.map +0 -1
- package/dist/cli/index.js +0 -79
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/index.mjs +0 -79
- package/dist/cli/index.mjs.map +0 -1
- package/dist/cli/utils/commander.js +0 -111
- package/dist/cli/utils/commander.js.map +0 -1
- package/dist/cli/utils/commander.mjs +0 -108
- package/dist/cli/utils/commander.mjs.map +0 -1
- package/dist/cli/utils/data-transfer.js +0 -354
- package/dist/cli/utils/data-transfer.js.map +0 -1
- package/dist/cli/utils/data-transfer.mjs +0 -350
- package/dist/cli/utils/data-transfer.mjs.map +0 -1
- package/dist/cli/utils/helpers.js +0 -102
- package/dist/cli/utils/helpers.js.map +0 -1
- package/dist/cli/utils/helpers.mjs +0 -100
- package/dist/cli/utils/helpers.mjs.map +0 -1
- package/dist/cli/utils/logger.js +0 -137
- package/dist/cli/utils/logger.js.map +0 -1
- package/dist/cli/utils/logger.mjs +0 -116
- package/dist/cli/utils/logger.mjs.map +0 -1
- package/dist/cli/utils/telemetry.js +0 -22
- package/dist/cli/utils/telemetry.js.map +0 -1
- package/dist/cli/utils/telemetry.mjs +0 -22
- package/dist/cli/utils/telemetry.mjs.map +0 -1
- package/dist/cli/utils/tsconfig.js +0 -26
- package/dist/cli/utils/tsconfig.js.map +0 -1
- package/dist/cli/utils/tsconfig.mjs +0 -23
- package/dist/cli/utils/tsconfig.mjs.map +0 -1
- package/dist/node/build.js +0 -76
- package/dist/node/build.js.map +0 -1
- package/dist/node/build.mjs +0 -58
- package/dist/node/build.mjs.map +0 -1
- package/dist/node/core/admin-customisations.js +0 -24
- package/dist/node/core/admin-customisations.js.map +0 -1
- package/dist/node/core/admin-customisations.mjs +0 -22
- package/dist/node/core/admin-customisations.mjs.map +0 -1
- package/dist/node/core/aliases.js +0 -33
- package/dist/node/core/aliases.js.map +0 -1
- package/dist/node/core/aliases.mjs +0 -31
- package/dist/node/core/aliases.mjs.map +0 -1
- package/dist/node/core/config.js +0 -18
- package/dist/node/core/config.js.map +0 -1
- package/dist/node/core/config.mjs +0 -16
- package/dist/node/core/config.mjs.map +0 -1
- package/dist/node/core/dependencies.js +0 -163
- package/dist/node/core/dependencies.js.map +0 -1
- package/dist/node/core/dependencies.mjs +0 -155
- package/dist/node/core/dependencies.mjs.map +0 -1
- package/dist/node/core/env.js +0 -26
- package/dist/node/core/env.js.map +0 -1
- package/dist/node/core/env.mjs +0 -23
- package/dist/node/core/env.mjs.map +0 -1
- package/dist/node/core/errors.js +0 -33
- package/dist/node/core/errors.js.map +0 -1
- package/dist/node/core/errors.mjs +0 -29
- package/dist/node/core/errors.mjs.map +0 -1
- package/dist/node/core/files.js +0 -45
- package/dist/node/core/files.js.map +0 -1
- package/dist/node/core/files.mjs +0 -43
- package/dist/node/core/files.mjs.map +0 -1
- package/dist/node/core/managers.js +0 -17
- package/dist/node/core/managers.js.map +0 -1
- package/dist/node/core/managers.mjs +0 -17
- package/dist/node/core/managers.mjs.map +0 -1
- package/dist/node/core/monorepo.js +0 -23
- package/dist/node/core/monorepo.js.map +0 -1
- package/dist/node/core/monorepo.mjs +0 -20
- package/dist/node/core/monorepo.mjs.map +0 -1
- package/dist/node/core/plugins.js +0 -116
- package/dist/node/core/plugins.js.map +0 -1
- package/dist/node/core/plugins.mjs +0 -111
- package/dist/node/core/plugins.mjs.map +0 -1
- package/dist/node/core/timer.js +0 -27
- package/dist/node/core/timer.js.map +0 -1
- package/dist/node/core/timer.mjs +0 -27
- package/dist/node/core/timer.mjs.map +0 -1
- package/dist/node/create-build-context.js +0 -101
- package/dist/node/create-build-context.js.map +0 -1
- package/dist/node/create-build-context.mjs +0 -96
- package/dist/node/create-build-context.mjs.map +0 -1
- package/dist/node/develop.js +0 -275
- package/dist/node/develop.js.map +0 -1
- package/dist/node/develop.mjs +0 -252
- package/dist/node/develop.mjs.map +0 -1
- package/dist/node/staticFiles.js +0 -102
- package/dist/node/staticFiles.js.map +0 -1
- package/dist/node/staticFiles.mjs +0 -76
- package/dist/node/staticFiles.mjs.map +0 -1
- package/dist/node/vite/build.js +0 -34
- package/dist/node/vite/build.js.map +0 -1
- package/dist/node/vite/build.mjs +0 -12
- package/dist/node/vite/build.mjs.map +0 -1
- package/dist/node/vite/config.js +0 -106
- package/dist/node/vite/config.js.map +0 -1
- package/dist/node/vite/config.mjs +0 -103
- package/dist/node/vite/config.mjs.map +0 -1
- package/dist/node/vite/plugins.js +0 -43
- package/dist/node/vite/plugins.js.map +0 -1
- package/dist/node/vite/plugins.mjs +0 -43
- package/dist/node/vite/plugins.mjs.map +0 -1
- package/dist/node/vite/watch.js +0 -111
- package/dist/node/vite/watch.js.map +0 -1
- package/dist/node/vite/watch.mjs +0 -85
- package/dist/node/vite/watch.mjs.map +0 -1
- package/dist/node/webpack/build.js +0 -41
- package/dist/node/webpack/build.js.map +0 -1
- package/dist/node/webpack/build.mjs +0 -39
- package/dist/node/webpack/build.mjs.map +0 -1
- package/dist/node/webpack/config.js +0 -259
- package/dist/node/webpack/config.js.map +0 -1
- package/dist/node/webpack/config.mjs +0 -228
- package/dist/node/webpack/config.mjs.map +0 -1
- package/dist/node/webpack/watch.js +0 -95
- package/dist/node/webpack/watch.js.map +0 -1
- package/dist/node/webpack/watch.mjs +0 -90
- package/dist/node/webpack/watch.mjs.map +0 -1
package/dist/node/core/files.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const path = require("node:path");
|
|
4
|
-
const fs = require("node:fs/promises");
|
|
5
|
-
const node = require("esbuild-register/dist/node");
|
|
6
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
7
|
-
const path__default = /* @__PURE__ */ _interopDefault(path);
|
|
8
|
-
const pathExists = async (path2) => {
|
|
9
|
-
try {
|
|
10
|
-
await fs.access(path2);
|
|
11
|
-
return true;
|
|
12
|
-
} catch (error) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
const loadFile = async (path2) => {
|
|
17
|
-
if (await pathExists(path2)) {
|
|
18
|
-
const esbuildOptions = {
|
|
19
|
-
extensions: [".js", ".mjs", ".ts"]
|
|
20
|
-
};
|
|
21
|
-
const { unregister } = node.register(esbuildOptions);
|
|
22
|
-
const mod = require(path2);
|
|
23
|
-
unregister();
|
|
24
|
-
const file = mod?.default || mod || void 0;
|
|
25
|
-
return file;
|
|
26
|
-
}
|
|
27
|
-
return void 0;
|
|
28
|
-
};
|
|
29
|
-
const convertSystemPathToModulePath = (sysPath) => {
|
|
30
|
-
if (process.platform === "win32") {
|
|
31
|
-
return sysPath.split(path__default.default.sep).join(path__default.default.posix.sep);
|
|
32
|
-
}
|
|
33
|
-
return sysPath;
|
|
34
|
-
};
|
|
35
|
-
const convertModulePathToSystemPath = (modulePath) => {
|
|
36
|
-
if (process.platform === "win32") {
|
|
37
|
-
return modulePath.split(path__default.default.posix.sep).join(path__default.default.sep);
|
|
38
|
-
}
|
|
39
|
-
return modulePath;
|
|
40
|
-
};
|
|
41
|
-
exports.convertModulePathToSystemPath = convertModulePathToSystemPath;
|
|
42
|
-
exports.convertSystemPathToModulePath = convertSystemPathToModulePath;
|
|
43
|
-
exports.loadFile = loadFile;
|
|
44
|
-
exports.pathExists = pathExists;
|
|
45
|
-
//# sourceMappingURL=files.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sources":["../../../src/node/core/files.ts"],"sourcesContent":["import path from 'node:path';\nimport { access } from 'node:fs/promises';\nimport { register } from 'esbuild-register/dist/node';\n\n/**\n * @internal\n */\nconst pathExists = async (path: string) => {\n try {\n await access(path);\n return true;\n } catch (error) {\n return false;\n }\n};\n\n/**\n * @internal\n */\nconst loadFile = async (path: string): Promise<undefined | any> => {\n if (await pathExists(path)) {\n const esbuildOptions: Parameters<typeof register>[0] = {\n extensions: ['.js', '.mjs', '.ts'],\n };\n\n const { unregister } = register(esbuildOptions);\n\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const mod = require(path);\n\n unregister();\n\n /**\n * handles esm or cjs exporting.\n */\n const file = mod?.default || mod || undefined;\n\n return file;\n }\n\n return undefined;\n};\n\n/**\n * @internal\n *\n * @description Converts a system path to a module path mainly for `Windows` systems.\n * where the path separator is `\\` instead of `/`, on linux systems the path separator\n * is identical to the module path separator.\n */\nconst convertSystemPathToModulePath = (sysPath: string) => {\n if (process.platform === 'win32') {\n return sysPath.split(path.sep).join(path.posix.sep);\n }\n\n return sysPath;\n};\n\n/**\n * @internal\n *\n * @description Converts a module path to a system path, again largely used for Windows systems.\n * The original use case was plugins where the resolve path was in module format but we want to\n * have it relative to the runtime directory.\n */\nconst convertModulePathToSystemPath = (modulePath: string) => {\n if (process.platform === 'win32') {\n return modulePath.split(path.posix.sep).join(path.sep);\n }\n\n return modulePath;\n};\n\nexport { pathExists, loadFile, convertSystemPathToModulePath, convertModulePathToSystemPath };\n"],"names":["path","access","register"],"mappings":";;;;;;;AAOM,MAAA,aAAa,OAAOA,UAAiB;AACrC,MAAA;AACF,UAAMC,GAAAA,OAAOD,KAAI;AACV,WAAA;AAAA,WACA,OAAO;AACP,WAAA;AAAA,EAAA;AAEX;AAKM,MAAA,WAAW,OAAOA,UAA2C;AAC7D,MAAA,MAAM,WAAWA,KAAI,GAAG;AAC1B,UAAM,iBAAiD;AAAA,MACrD,YAAY,CAAC,OAAO,QAAQ,KAAK;AAAA,IACnC;AAEA,UAAM,EAAE,WAAA,IAAeE,KAAA,SAAS,cAAc;AAGxC,UAAA,MAAM,QAAQF,KAAI;AAEb,eAAA;AAKL,UAAA,OAAO,KAAK,WAAW,OAAO;AAE7B,WAAA;AAAA,EAAA;AAGF,SAAA;AACT;AASM,MAAA,gCAAgC,CAAC,YAAoB;AACrD,MAAA,QAAQ,aAAa,SAAS;AACzB,WAAA,QAAQ,MAAMA,sBAAK,GAAG,EAAE,KAAKA,cAAAA,QAAK,MAAM,GAAG;AAAA,EAAA;AAG7C,SAAA;AACT;AASM,MAAA,gCAAgC,CAAC,eAAuB;AACxD,MAAA,QAAQ,aAAa,SAAS;AACzB,WAAA,WAAW,MAAMA,sBAAK,MAAM,GAAG,EAAE,KAAKA,sBAAK,GAAG;AAAA,EAAA;AAGhD,SAAA;AACT;;;;;"}
|
package/dist/node/core/files.mjs
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { access } from "node:fs/promises";
|
|
3
|
-
import { register } from "esbuild-register/dist/node";
|
|
4
|
-
const pathExists = async (path2) => {
|
|
5
|
-
try {
|
|
6
|
-
await access(path2);
|
|
7
|
-
return true;
|
|
8
|
-
} catch (error) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
const loadFile = async (path2) => {
|
|
13
|
-
if (await pathExists(path2)) {
|
|
14
|
-
const esbuildOptions = {
|
|
15
|
-
extensions: [".js", ".mjs", ".ts"]
|
|
16
|
-
};
|
|
17
|
-
const { unregister } = register(esbuildOptions);
|
|
18
|
-
const mod = require(path2);
|
|
19
|
-
unregister();
|
|
20
|
-
const file = mod?.default || mod || void 0;
|
|
21
|
-
return file;
|
|
22
|
-
}
|
|
23
|
-
return void 0;
|
|
24
|
-
};
|
|
25
|
-
const convertSystemPathToModulePath = (sysPath) => {
|
|
26
|
-
if (process.platform === "win32") {
|
|
27
|
-
return sysPath.split(path.sep).join(path.posix.sep);
|
|
28
|
-
}
|
|
29
|
-
return sysPath;
|
|
30
|
-
};
|
|
31
|
-
const convertModulePathToSystemPath = (modulePath) => {
|
|
32
|
-
if (process.platform === "win32") {
|
|
33
|
-
return modulePath.split(path.posix.sep).join(path.sep);
|
|
34
|
-
}
|
|
35
|
-
return modulePath;
|
|
36
|
-
};
|
|
37
|
-
export {
|
|
38
|
-
convertModulePathToSystemPath,
|
|
39
|
-
convertSystemPathToModulePath,
|
|
40
|
-
loadFile,
|
|
41
|
-
pathExists
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=files.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"files.mjs","sources":["../../../src/node/core/files.ts"],"sourcesContent":["import path from 'node:path';\nimport { access } from 'node:fs/promises';\nimport { register } from 'esbuild-register/dist/node';\n\n/**\n * @internal\n */\nconst pathExists = async (path: string) => {\n try {\n await access(path);\n return true;\n } catch (error) {\n return false;\n }\n};\n\n/**\n * @internal\n */\nconst loadFile = async (path: string): Promise<undefined | any> => {\n if (await pathExists(path)) {\n const esbuildOptions: Parameters<typeof register>[0] = {\n extensions: ['.js', '.mjs', '.ts'],\n };\n\n const { unregister } = register(esbuildOptions);\n\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const mod = require(path);\n\n unregister();\n\n /**\n * handles esm or cjs exporting.\n */\n const file = mod?.default || mod || undefined;\n\n return file;\n }\n\n return undefined;\n};\n\n/**\n * @internal\n *\n * @description Converts a system path to a module path mainly for `Windows` systems.\n * where the path separator is `\\` instead of `/`, on linux systems the path separator\n * is identical to the module path separator.\n */\nconst convertSystemPathToModulePath = (sysPath: string) => {\n if (process.platform === 'win32') {\n return sysPath.split(path.sep).join(path.posix.sep);\n }\n\n return sysPath;\n};\n\n/**\n * @internal\n *\n * @description Converts a module path to a system path, again largely used for Windows systems.\n * The original use case was plugins where the resolve path was in module format but we want to\n * have it relative to the runtime directory.\n */\nconst convertModulePathToSystemPath = (modulePath: string) => {\n if (process.platform === 'win32') {\n return modulePath.split(path.posix.sep).join(path.sep);\n }\n\n return modulePath;\n};\n\nexport { pathExists, loadFile, convertSystemPathToModulePath, convertModulePathToSystemPath };\n"],"names":["path"],"mappings":";;;AAOM,MAAA,aAAa,OAAOA,UAAiB;AACrC,MAAA;AACF,UAAM,OAAOA,KAAI;AACV,WAAA;AAAA,WACA,OAAO;AACP,WAAA;AAAA,EAAA;AAEX;AAKM,MAAA,WAAW,OAAOA,UAA2C;AAC7D,MAAA,MAAM,WAAWA,KAAI,GAAG;AAC1B,UAAM,iBAAiD;AAAA,MACrD,YAAY,CAAC,OAAO,QAAQ,KAAK;AAAA,IACnC;AAEA,UAAM,EAAE,WAAA,IAAe,SAAS,cAAc;AAGxC,UAAA,MAAM,QAAQA,KAAI;AAEb,eAAA;AAKL,UAAA,OAAO,KAAK,WAAW,OAAO;AAE7B,WAAA;AAAA,EAAA;AAGF,SAAA;AACT;AASM,MAAA,gCAAgC,CAAC,YAAoB;AACrD,MAAA,QAAQ,aAAa,SAAS;AACzB,WAAA,QAAQ,MAAM,KAAK,GAAG,EAAE,KAAK,KAAK,MAAM,GAAG;AAAA,EAAA;AAG7C,SAAA;AACT;AASM,MAAA,gCAAgC,CAAC,eAAuB;AACxD,MAAA,QAAQ,aAAa,SAAS;AACzB,WAAA,WAAW,MAAM,KAAK,MAAM,GAAG,EAAE,KAAK,KAAK,GAAG;AAAA,EAAA;AAGhD,SAAA;AACT;"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const getPackageManager = () => {
|
|
4
|
-
const agent = process.env.npm_config_user_agent || "";
|
|
5
|
-
if (agent.includes("yarn")) {
|
|
6
|
-
return "yarn";
|
|
7
|
-
}
|
|
8
|
-
if (agent.includes("pnpm")) {
|
|
9
|
-
return "pnpm";
|
|
10
|
-
}
|
|
11
|
-
if (/^npm\/\d/.test(agent)) {
|
|
12
|
-
return "npm";
|
|
13
|
-
}
|
|
14
|
-
return void 0;
|
|
15
|
-
};
|
|
16
|
-
exports.getPackageManager = getPackageManager;
|
|
17
|
-
//# sourceMappingURL=managers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"managers.js","sources":["../../../src/node/core/managers.ts"],"sourcesContent":["/**\n * @description Supports the following managers:\n * – npm\n * – yarn\n * – pnpm\n */\nconst getPackageManager = () => {\n // Yes, the env var is lowercase - it is set by the package managers themselves\n const agent = process.env.npm_config_user_agent || '';\n\n if (agent.includes('yarn')) {\n return 'yarn';\n }\n\n if (agent.includes('pnpm')) {\n return 'pnpm';\n }\n\n // Both yarn and pnpm does a `npm/?` thing, thus the slightly different match here\n // Theoretically not needed since we check for yarn/pnpm above, but in case other\n // package managers do the same thing, we'll (hopefully) catch them here.\n if (/^npm\\/\\d/.test(agent)) {\n return 'npm';\n }\n\n return undefined;\n};\n\nexport { getPackageManager };\n"],"names":[],"mappings":";;AAMA,MAAM,oBAAoB,MAAM;AAExB,QAAA,QAAQ,QAAQ,IAAI,yBAAyB;AAE/C,MAAA,MAAM,SAAS,MAAM,GAAG;AACnB,WAAA;AAAA,EAAA;AAGL,MAAA,MAAM,SAAS,MAAM,GAAG;AACnB,WAAA;AAAA,EAAA;AAML,MAAA,WAAW,KAAK,KAAK,GAAG;AACnB,WAAA;AAAA,EAAA;AAGF,SAAA;AACT;;"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const getPackageManager = () => {
|
|
2
|
-
const agent = process.env.npm_config_user_agent || "";
|
|
3
|
-
if (agent.includes("yarn")) {
|
|
4
|
-
return "yarn";
|
|
5
|
-
}
|
|
6
|
-
if (agent.includes("pnpm")) {
|
|
7
|
-
return "pnpm";
|
|
8
|
-
}
|
|
9
|
-
if (/^npm\/\d/.test(agent)) {
|
|
10
|
-
return "npm";
|
|
11
|
-
}
|
|
12
|
-
return void 0;
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
getPackageManager
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=managers.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"managers.mjs","sources":["../../../src/node/core/managers.ts"],"sourcesContent":["/**\n * @description Supports the following managers:\n * – npm\n * – yarn\n * – pnpm\n */\nconst getPackageManager = () => {\n // Yes, the env var is lowercase - it is set by the package managers themselves\n const agent = process.env.npm_config_user_agent || '';\n\n if (agent.includes('yarn')) {\n return 'yarn';\n }\n\n if (agent.includes('pnpm')) {\n return 'pnpm';\n }\n\n // Both yarn and pnpm does a `npm/?` thing, thus the slightly different match here\n // Theoretically not needed since we check for yarn/pnpm above, but in case other\n // package managers do the same thing, we'll (hopefully) catch them here.\n if (/^npm\\/\\d/.test(agent)) {\n return 'npm';\n }\n\n return undefined;\n};\n\nexport { getPackageManager };\n"],"names":[],"mappings":"AAMA,MAAM,oBAAoB,MAAM;AAExB,QAAA,QAAQ,QAAQ,IAAI,yBAAyB;AAE/C,MAAA,MAAM,SAAS,MAAM,GAAG;AACnB,WAAA;AAAA,EAAA;AAGL,MAAA,MAAM,SAAS,MAAM,GAAG;AACnB,WAAA;AAAA,EAAA;AAML,MAAA,WAAW,KAAK,KAAK,GAAG;AACnB,WAAA;AAAA,EAAA;AAGF,SAAA;AACT;"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const readPkgUp = require("read-pkg-up");
|
|
5
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
6
|
-
const path__default = /* @__PURE__ */ _interopDefault(path);
|
|
7
|
-
const readPkgUp__default = /* @__PURE__ */ _interopDefault(readPkgUp);
|
|
8
|
-
async function loadStrapiMonorepo(cwd) {
|
|
9
|
-
let p = cwd;
|
|
10
|
-
while (p !== "/") {
|
|
11
|
-
const readResult = await readPkgUp__default.default({ cwd: p });
|
|
12
|
-
if (!readResult) {
|
|
13
|
-
return void 0;
|
|
14
|
-
}
|
|
15
|
-
if (readResult.packageJson.isStrapiMonorepo) {
|
|
16
|
-
return { path: path__default.default.dirname(readResult.path) };
|
|
17
|
-
}
|
|
18
|
-
p = path__default.default.dirname(path__default.default.dirname(readResult.path));
|
|
19
|
-
}
|
|
20
|
-
return void 0;
|
|
21
|
-
}
|
|
22
|
-
exports.loadStrapiMonorepo = loadStrapiMonorepo;
|
|
23
|
-
//# sourceMappingURL=monorepo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"monorepo.js","sources":["../../../src/node/core/monorepo.ts"],"sourcesContent":["import path from 'path';\nimport readPkgUp from 'read-pkg-up';\n\ninterface StrapiMonorepo {\n path: string;\n}\n\n/**\n * Load information about the strapi CMS monorepo (if applicable)\n *\n * @internal\n */\nasync function loadStrapiMonorepo(cwd: string): Promise<StrapiMonorepo | undefined> {\n let p = cwd;\n\n while (p !== '/') {\n const readResult = await readPkgUp({ cwd: p });\n\n if (!readResult) {\n return undefined;\n }\n\n if (readResult.packageJson.isStrapiMonorepo) {\n return { path: path.dirname(readResult.path) };\n }\n\n p = path.dirname(path.dirname(readResult.path));\n }\n\n return undefined;\n}\n\nexport { loadStrapiMonorepo };\nexport type { StrapiMonorepo };\n"],"names":["readPkgUp","path"],"mappings":";;;;;;;AAYA,eAAe,mBAAmB,KAAkD;AAClF,MAAI,IAAI;AAER,SAAO,MAAM,KAAK;AAChB,UAAM,aAAa,MAAMA,mBAAAA,QAAU,EAAE,KAAK,GAAG;AAE7C,QAAI,CAAC,YAAY;AACR,aAAA;AAAA,IAAA;AAGL,QAAA,WAAW,YAAY,kBAAkB;AAC3C,aAAO,EAAE,MAAMC,cAAA,QAAK,QAAQ,WAAW,IAAI,EAAE;AAAA,IAAA;AAG/C,QAAIA,sBAAK,QAAQA,cAAAA,QAAK,QAAQ,WAAW,IAAI,CAAC;AAAA,EAAA;AAGzC,SAAA;AACT;;"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import readPkgUp from "read-pkg-up";
|
|
3
|
-
async function loadStrapiMonorepo(cwd) {
|
|
4
|
-
let p = cwd;
|
|
5
|
-
while (p !== "/") {
|
|
6
|
-
const readResult = await readPkgUp({ cwd: p });
|
|
7
|
-
if (!readResult) {
|
|
8
|
-
return void 0;
|
|
9
|
-
}
|
|
10
|
-
if (readResult.packageJson.isStrapiMonorepo) {
|
|
11
|
-
return { path: path.dirname(readResult.path) };
|
|
12
|
-
}
|
|
13
|
-
p = path.dirname(path.dirname(readResult.path));
|
|
14
|
-
}
|
|
15
|
-
return void 0;
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
loadStrapiMonorepo
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=monorepo.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"monorepo.mjs","sources":["../../../src/node/core/monorepo.ts"],"sourcesContent":["import path from 'path';\nimport readPkgUp from 'read-pkg-up';\n\ninterface StrapiMonorepo {\n path: string;\n}\n\n/**\n * Load information about the strapi CMS monorepo (if applicable)\n *\n * @internal\n */\nasync function loadStrapiMonorepo(cwd: string): Promise<StrapiMonorepo | undefined> {\n let p = cwd;\n\n while (p !== '/') {\n const readResult = await readPkgUp({ cwd: p });\n\n if (!readResult) {\n return undefined;\n }\n\n if (readResult.packageJson.isStrapiMonorepo) {\n return { path: path.dirname(readResult.path) };\n }\n\n p = path.dirname(path.dirname(readResult.path));\n }\n\n return undefined;\n}\n\nexport { loadStrapiMonorepo };\nexport type { StrapiMonorepo };\n"],"names":[],"mappings":";;AAYA,eAAe,mBAAmB,KAAkD;AAClF,MAAI,IAAI;AAER,SAAO,MAAM,KAAK;AAChB,UAAM,aAAa,MAAM,UAAU,EAAE,KAAK,GAAG;AAE7C,QAAI,CAAC,YAAY;AACR,aAAA;AAAA,IAAA;AAGL,QAAA,WAAW,YAAY,kBAAkB;AAC3C,aAAO,EAAE,MAAM,KAAK,QAAQ,WAAW,IAAI,EAAE;AAAA,IAAA;AAG/C,QAAI,KAAK,QAAQ,KAAK,QAAQ,WAAW,IAAI,CAAC;AAAA,EAAA;AAGzC,SAAA;AACT;"}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const os = require("node:os");
|
|
4
|
-
const path = require("node:path");
|
|
5
|
-
const fs = require("node:fs");
|
|
6
|
-
const camelCase = require("lodash/camelCase");
|
|
7
|
-
const utils = require("@strapi/utils");
|
|
8
|
-
const dependencies = require("./dependencies.js");
|
|
9
|
-
const files = require("./files.js");
|
|
10
|
-
const errors = require("./errors.js");
|
|
11
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
12
|
-
const os__default = /* @__PURE__ */ _interopDefault(os);
|
|
13
|
-
const path__default = /* @__PURE__ */ _interopDefault(path);
|
|
14
|
-
const fs__default = /* @__PURE__ */ _interopDefault(fs);
|
|
15
|
-
const camelCase__default = /* @__PURE__ */ _interopDefault(camelCase);
|
|
16
|
-
const validatePackageHasStrapi = (pkg) => "strapi" in pkg && typeof pkg.strapi === "object" && !Array.isArray(pkg.strapi) && pkg.strapi !== null;
|
|
17
|
-
const validatePackageIsPlugin = (pkg) => validatePackageHasStrapi(pkg) && pkg.strapi.kind === "plugin";
|
|
18
|
-
const getEnabledPlugins = async ({
|
|
19
|
-
cwd,
|
|
20
|
-
logger,
|
|
21
|
-
runtimeDir,
|
|
22
|
-
strapi
|
|
23
|
-
}) => {
|
|
24
|
-
const plugins = {};
|
|
25
|
-
const deps = strapi.config.get("info.dependencies", {});
|
|
26
|
-
logger.debug("Dependencies from user's project", os__default.default.EOL, deps);
|
|
27
|
-
for (const dep of Object.keys(deps)) {
|
|
28
|
-
const pkg = await dependencies.getModule(dep, cwd);
|
|
29
|
-
if (pkg && validatePackageIsPlugin(pkg)) {
|
|
30
|
-
const name = pkg.strapi.name || pkg.name;
|
|
31
|
-
if (!name) {
|
|
32
|
-
throw Error(
|
|
33
|
-
"You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!"
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
plugins[name] = {
|
|
37
|
-
name,
|
|
38
|
-
importName: camelCase__default.default(name),
|
|
39
|
-
type: "module",
|
|
40
|
-
modulePath: dep
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);
|
|
45
|
-
logger.debug("User's plugins file", os__default.default.EOL, userPluginsFile);
|
|
46
|
-
for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)) {
|
|
47
|
-
if (userPluginConfig.enabled && userPluginConfig.resolve) {
|
|
48
|
-
const sysPath = files.convertModulePathToSystemPath(userPluginConfig.resolve);
|
|
49
|
-
plugins[userPluginName] = {
|
|
50
|
-
name: userPluginName,
|
|
51
|
-
importName: camelCase__default.default(userPluginName),
|
|
52
|
-
type: "local",
|
|
53
|
-
/**
|
|
54
|
-
* User plugin paths are resolved from the entry point
|
|
55
|
-
* of the app, because that's how you import them.
|
|
56
|
-
*/
|
|
57
|
-
modulePath: files.convertSystemPathToModulePath(path__default.default.relative(runtimeDir, sysPath)),
|
|
58
|
-
path: sysPath
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return plugins;
|
|
63
|
-
};
|
|
64
|
-
const PLUGIN_CONFIGS = ["plugins.js", "plugins.mjs", "plugins.ts"];
|
|
65
|
-
const loadUserPluginsFile = async (root) => {
|
|
66
|
-
for (const file of PLUGIN_CONFIGS) {
|
|
67
|
-
const filePath = path__default.default.join(root, file);
|
|
68
|
-
const configFile = await files.loadFile(filePath);
|
|
69
|
-
if (configFile) {
|
|
70
|
-
return typeof configFile === "function" ? configFile({ env: utils.env }) : configFile;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return {};
|
|
74
|
-
};
|
|
75
|
-
const getMapOfPluginsWithAdmin = (plugins) => {
|
|
76
|
-
const pluginImportPaths = {};
|
|
77
|
-
return Object.values(plugins).filter((plugin) => {
|
|
78
|
-
if (!plugin) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
try {
|
|
82
|
-
const localPluginPath = plugin.path;
|
|
83
|
-
if (localPluginPath) {
|
|
84
|
-
const packageJsonPath = path__default.default.join(localPluginPath, "package.json");
|
|
85
|
-
if (fs__default.default.existsSync(packageJsonPath)) {
|
|
86
|
-
const packageJson = JSON.parse(fs__default.default.readFileSync(packageJsonPath, "utf-8"));
|
|
87
|
-
const localAdminPath = packageJson?.exports?.["./strapi-admin"]?.import;
|
|
88
|
-
if (localAdminPath) {
|
|
89
|
-
pluginImportPaths[plugin.modulePath] = localAdminPath;
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (fs__default.default.existsSync(path__default.default.join(localPluginPath, "strapi-admin.js"))) {
|
|
94
|
-
pluginImportPaths[plugin.modulePath] = "strapi-admin";
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (require.resolve(`${plugin.modulePath}/strapi-admin`)) {
|
|
99
|
-
pluginImportPaths[plugin.modulePath] = "strapi-admin";
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
return false;
|
|
103
|
-
} catch (err) {
|
|
104
|
-
if (errors.isError(err) && "code" in err && (err.code === "MODULE_NOT_FOUND" || err.code === "ERR_PACKAGE_PATH_NOT_EXPORTED")) {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
throw err;
|
|
108
|
-
}
|
|
109
|
-
}).map((plugin) => ({
|
|
110
|
-
...plugin,
|
|
111
|
-
modulePath: `${plugin.modulePath}/${pluginImportPaths[plugin.modulePath]}`
|
|
112
|
-
}));
|
|
113
|
-
};
|
|
114
|
-
exports.getEnabledPlugins = getEnabledPlugins;
|
|
115
|
-
exports.getMapOfPluginsWithAdmin = getMapOfPluginsWithAdmin;
|
|
116
|
-
//# sourceMappingURL=plugins.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sources":["../../../src/node/core/plugins.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport camelCase from 'lodash/camelCase';\nimport { env } from '@strapi/utils';\nimport { getModule, PackageJson } from './dependencies';\nimport { convertModulePathToSystemPath, convertSystemPathToModulePath, loadFile } from './files';\nimport type { BaseContext } from '../types';\nimport { isError } from './errors';\n\ninterface LocalPluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * The path to the plugin, relative to the app's root directory\n * in system format\n */\n path: string;\n /**\n * The path to the plugin, relative to the runtime directory\n * in module format (i.e. with forward slashes) because thats\n * where it should be used as an import\n */\n modulePath: string;\n type: 'local';\n}\n\ninterface ModulePluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * Modules don't have a path because we never resolve them to their node_modules\n * because we simply do not require it.\n */\n path?: never;\n /**\n * The path to the plugin, relative to the app's root directory\n * in module format (i.e. with forward slashes)\n */\n modulePath: string;\n type: 'module';\n}\n\ntype PluginMeta = LocalPluginMeta | ModulePluginMeta;\n\ninterface StrapiPlugin extends PackageJson {\n strapi: {\n description?: string;\n displayName?: string;\n kind: 'plugin';\n name?: string;\n required?: boolean;\n };\n}\n\nconst validatePackageHasStrapi = (\n pkg: PackageJson\n): pkg is PackageJson & { strapi: Record<string, unknown> } =>\n 'strapi' in pkg &&\n typeof pkg.strapi === 'object' &&\n !Array.isArray(pkg.strapi) &&\n pkg.strapi !== null;\n\nconst validatePackageIsPlugin = (pkg: PackageJson): pkg is StrapiPlugin =>\n validatePackageHasStrapi(pkg) && pkg.strapi.kind === 'plugin';\n\nconst getEnabledPlugins = async ({\n cwd,\n logger,\n runtimeDir,\n strapi,\n}: Pick<BaseContext, 'cwd' | 'logger' | 'strapi' | 'runtimeDir'>): Promise<\n Record<string, PluginMeta>\n> => {\n const plugins: Record<string, PluginMeta> = {};\n\n /**\n * This is the list of dependencies that are installed in the user's project.\n * It will include libraries like \"react\", so we need to collect the ones that\n * are plugins.\n */\n const deps = strapi.config.get('info.dependencies', {});\n\n logger.debug(\"Dependencies from user's project\", os.EOL, deps);\n\n for (const dep of Object.keys(deps)) {\n const pkg = await getModule(dep, cwd);\n\n if (pkg && validatePackageIsPlugin(pkg)) {\n const name = pkg.strapi.name || pkg.name;\n\n if (!name) {\n /**\n * Unlikely to happen, but you never know.\n */\n throw Error(\n \"You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!\"\n );\n }\n\n plugins[name] = {\n name,\n importName: camelCase(name),\n type: 'module',\n modulePath: dep,\n };\n }\n }\n\n const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);\n\n logger.debug(\"User's plugins file\", os.EOL, userPluginsFile);\n\n for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)) {\n if (userPluginConfig.enabled && userPluginConfig.resolve) {\n const sysPath = convertModulePathToSystemPath(userPluginConfig.resolve);\n plugins[userPluginName] = {\n name: userPluginName,\n importName: camelCase(userPluginName),\n type: 'local',\n /**\n * User plugin paths are resolved from the entry point\n * of the app, because that's how you import them.\n */\n modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, sysPath)),\n path: sysPath,\n };\n }\n }\n\n return plugins;\n};\n\nconst PLUGIN_CONFIGS = ['plugins.js', 'plugins.mjs', 'plugins.ts'];\n\ntype UserPluginConfigFile = Record<string, { enabled: boolean; resolve: string }>;\n\nconst loadUserPluginsFile = async (root: string): Promise<UserPluginConfigFile> => {\n for (const file of PLUGIN_CONFIGS) {\n const filePath = path.join(root, file);\n const configFile = await loadFile(filePath);\n\n if (configFile) {\n /**\n * Configs can be a function or they can be just an object!\n */\n return typeof configFile === 'function' ? configFile({ env }) : configFile;\n }\n }\n\n return {};\n};\n\nconst getMapOfPluginsWithAdmin = (plugins: Record<string, PluginMeta>) => {\n /**\n * This variable stores the import paths for plugins.\n * The keys are the module paths of the plugins, and the values are the paths\n * to the admin part of the plugins, which is either loaded from the\n * package.json exports or from the legacy strapi-admin.js file.\n */\n const pluginImportPaths: Record<string, string> = {};\n\n return Object.values(plugins)\n .filter((plugin) => {\n if (!plugin) {\n return false;\n }\n\n /**\n * There are two ways a plugin should be imported, either it's local to the strapi app,\n * or it's an actual npm module that's installed and resolved via node_modules.\n *\n * We first check if the plugin is local to the strapi app, using a regular `fs.existsSync` because\n * the pathToPlugin will be relative i.e. `/Users/my-name/strapi-app/src/plugins/my-plugin`.\n *\n * If the file doesn't exist well then it's probably a node_module, so instead we use `require.resolve`\n * which will resolve the path to the module in node_modules. If it fails with the specific code `MODULE_NOT_FOUND`\n * then it doesn't have an admin part to the package.\n */\n try {\n const localPluginPath = plugin.path;\n if (localPluginPath) {\n // Here we are loading a locally installed plugin\n const packageJsonPath = path.join(localPluginPath, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n const localAdminPath = packageJson?.exports?.['./strapi-admin']?.import;\n\n if (localAdminPath) {\n pluginImportPaths[plugin.modulePath] = localAdminPath;\n return true;\n }\n }\n\n // Check if legacy admin file exists in local plugin\n if (fs.existsSync(path.join(localPluginPath, 'strapi-admin.js'))) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n }\n\n // This plugin is a module, so we need to check if it has a strapi-admin export\n if (require.resolve(`${plugin.modulePath}/strapi-admin`)) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n\n return false;\n } catch (err) {\n if (\n isError(err) &&\n 'code' in err &&\n (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')\n ) {\n /**\n * the plugin does not contain FE code, so we\n * don't want to import it anyway\n */\n return false;\n }\n\n throw err;\n }\n })\n .map((plugin) => ({\n ...plugin,\n modulePath: `${plugin.modulePath}/${pluginImportPaths[plugin.modulePath]}`,\n }));\n};\n\nexport { getEnabledPlugins, getMapOfPluginsWithAdmin };\nexport type { PluginMeta, LocalPluginMeta, ModulePluginMeta };\n"],"names":["os","getModule","camelCase","convertModulePathToSystemPath","convertSystemPathToModulePath","path","loadFile","env","fs","isError"],"mappings":";;;;;;;;;;;;;;;AA6DA,MAAM,2BAA2B,CAC/B,QAEA,YAAY,OACZ,OAAO,IAAI,WAAW,YACtB,CAAC,MAAM,QAAQ,IAAI,MAAM,KACzB,IAAI,WAAW;AAEjB,MAAM,0BAA0B,CAAC,QAC/B,yBAAyB,GAAG,KAAK,IAAI,OAAO,SAAS;AAEvD,MAAM,oBAAoB,OAAO;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAEK;AACH,QAAM,UAAsC,CAAC;AAO7C,QAAM,OAAO,OAAO,OAAO,IAAI,qBAAqB,CAAA,CAAE;AAEtD,SAAO,MAAM,oCAAoCA,YAAAA,QAAG,KAAK,IAAI;AAE7D,aAAW,OAAO,OAAO,KAAK,IAAI,GAAG;AACnC,UAAM,MAAM,MAAMC,uBAAU,KAAK,GAAG;AAEhC,QAAA,OAAO,wBAAwB,GAAG,GAAG;AACvC,YAAM,OAAO,IAAI,OAAO,QAAQ,IAAI;AAEpC,UAAI,CAAC,MAAM;AAIH,cAAA;AAAA,UACJ;AAAA,QACF;AAAA,MAAA;AAGF,cAAQ,IAAI,IAAI;AAAA,QACd;AAAA,QACA,YAAYC,2BAAU,IAAI;AAAA,QAC1B,MAAM;AAAA,QACN,YAAY;AAAA,MACd;AAAA,IAAA;AAAA,EACF;AAGF,QAAM,kBAAkB,MAAM,oBAAoB,OAAO,KAAK,IAAI,MAAM;AAExE,SAAO,MAAM,uBAAuBF,YAAAA,QAAG,KAAK,eAAe;AAE3D,aAAW,CAAC,gBAAgB,gBAAgB,KAAK,OAAO,QAAQ,eAAe,GAAG;AAC5E,QAAA,iBAAiB,WAAW,iBAAiB,SAAS;AAClD,YAAA,UAAUG,MAAAA,8BAA8B,iBAAiB,OAAO;AACtE,cAAQ,cAAc,IAAI;AAAA,QACxB,MAAM;AAAA,QACN,YAAYD,2BAAU,cAAc;AAAA,QACpC,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,QAKN,YAAYE,MAA8B,8BAAAC,cAAA,QAAK,SAAS,YAAY,OAAO,CAAC;AAAA,QAC5E,MAAM;AAAA,MACR;AAAA,IAAA;AAAA,EACF;AAGK,SAAA;AACT;AAEA,MAAM,iBAAiB,CAAC,cAAc,eAAe,YAAY;AAIjE,MAAM,sBAAsB,OAAO,SAAgD;AACjF,aAAW,QAAQ,gBAAgB;AACjC,UAAM,WAAWA,cAAA,QAAK,KAAK,MAAM,IAAI;AAC/B,UAAA,aAAa,MAAMC,MAAA,SAAS,QAAQ;AAE1C,QAAI,YAAY;AAId,aAAO,OAAO,eAAe,aAAa,WAAW,EAAEC,KAAAA,MAAAA,IAAK,CAAA,IAAI;AAAA,IAAA;AAAA,EAClE;AAGF,SAAO,CAAC;AACV;AAEM,MAAA,2BAA2B,CAAC,YAAwC;AAOxE,QAAM,oBAA4C,CAAC;AAEnD,SAAO,OAAO,OAAO,OAAO,EACzB,OAAO,CAAC,WAAW;AAClB,QAAI,CAAC,QAAQ;AACJ,aAAA;AAAA,IAAA;AAcL,QAAA;AACF,YAAM,kBAAkB,OAAO;AAC/B,UAAI,iBAAiB;AAEnB,cAAM,kBAAkBF,cAAA,QAAK,KAAK,iBAAiB,cAAc;AAE7D,YAAAG,YAAA,QAAG,WAAW,eAAe,GAAG;AAClC,gBAAM,cAAc,KAAK,MAAMA,oBAAG,aAAa,iBAAiB,OAAO,CAAC;AACxE,gBAAM,iBAAiB,aAAa,UAAU,gBAAgB,GAAG;AAEjE,cAAI,gBAAgB;AACA,8BAAA,OAAO,UAAU,IAAI;AAChC,mBAAA;AAAA,UAAA;AAAA,QACT;AAIF,YAAIA,YAAAA,QAAG,WAAWH,cAAA,QAAK,KAAK,iBAAiB,iBAAiB,CAAC,GAAG;AAC9C,4BAAA,OAAO,UAAU,IAAI;AAChC,iBAAA;AAAA,QAAA;AAAA,MACT;AAIF,UAAI,QAAQ,QAAQ,GAAG,OAAO,UAAU,eAAe,GAAG;AACtC,0BAAA,OAAO,UAAU,IAAI;AAChC,eAAA;AAAA,MAAA;AAGF,aAAA;AAAA,aACA,KAAK;AAEV,UAAAI,eAAQ,GAAG,KACX,UAAU,QACT,IAAI,SAAS,sBAAsB,IAAI,SAAS,kCACjD;AAKO,eAAA;AAAA,MAAA;AAGH,YAAA;AAAA,IAAA;AAAA,EACR,CACD,EACA,IAAI,CAAC,YAAY;AAAA,IAChB,GAAG;AAAA,IACH,YAAY,GAAG,OAAO,UAAU,IAAI,kBAAkB,OAAO,UAAU,CAAC;AAAA,EAAA,EACxE;AACN;;;"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import os from "node:os";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
import camelCase from "lodash/camelCase";
|
|
5
|
-
import { env } from "@strapi/utils";
|
|
6
|
-
import { getModule } from "./dependencies.mjs";
|
|
7
|
-
import { convertModulePathToSystemPath, convertSystemPathToModulePath, loadFile } from "./files.mjs";
|
|
8
|
-
import { isError } from "./errors.mjs";
|
|
9
|
-
const validatePackageHasStrapi = (pkg) => "strapi" in pkg && typeof pkg.strapi === "object" && !Array.isArray(pkg.strapi) && pkg.strapi !== null;
|
|
10
|
-
const validatePackageIsPlugin = (pkg) => validatePackageHasStrapi(pkg) && pkg.strapi.kind === "plugin";
|
|
11
|
-
const getEnabledPlugins = async ({
|
|
12
|
-
cwd,
|
|
13
|
-
logger,
|
|
14
|
-
runtimeDir,
|
|
15
|
-
strapi
|
|
16
|
-
}) => {
|
|
17
|
-
const plugins = {};
|
|
18
|
-
const deps = strapi.config.get("info.dependencies", {});
|
|
19
|
-
logger.debug("Dependencies from user's project", os.EOL, deps);
|
|
20
|
-
for (const dep of Object.keys(deps)) {
|
|
21
|
-
const pkg = await getModule(dep, cwd);
|
|
22
|
-
if (pkg && validatePackageIsPlugin(pkg)) {
|
|
23
|
-
const name = pkg.strapi.name || pkg.name;
|
|
24
|
-
if (!name) {
|
|
25
|
-
throw Error(
|
|
26
|
-
"You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!"
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
plugins[name] = {
|
|
30
|
-
name,
|
|
31
|
-
importName: camelCase(name),
|
|
32
|
-
type: "module",
|
|
33
|
-
modulePath: dep
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);
|
|
38
|
-
logger.debug("User's plugins file", os.EOL, userPluginsFile);
|
|
39
|
-
for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)) {
|
|
40
|
-
if (userPluginConfig.enabled && userPluginConfig.resolve) {
|
|
41
|
-
const sysPath = convertModulePathToSystemPath(userPluginConfig.resolve);
|
|
42
|
-
plugins[userPluginName] = {
|
|
43
|
-
name: userPluginName,
|
|
44
|
-
importName: camelCase(userPluginName),
|
|
45
|
-
type: "local",
|
|
46
|
-
/**
|
|
47
|
-
* User plugin paths are resolved from the entry point
|
|
48
|
-
* of the app, because that's how you import them.
|
|
49
|
-
*/
|
|
50
|
-
modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, sysPath)),
|
|
51
|
-
path: sysPath
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return plugins;
|
|
56
|
-
};
|
|
57
|
-
const PLUGIN_CONFIGS = ["plugins.js", "plugins.mjs", "plugins.ts"];
|
|
58
|
-
const loadUserPluginsFile = async (root) => {
|
|
59
|
-
for (const file of PLUGIN_CONFIGS) {
|
|
60
|
-
const filePath = path.join(root, file);
|
|
61
|
-
const configFile = await loadFile(filePath);
|
|
62
|
-
if (configFile) {
|
|
63
|
-
return typeof configFile === "function" ? configFile({ env }) : configFile;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return {};
|
|
67
|
-
};
|
|
68
|
-
const getMapOfPluginsWithAdmin = (plugins) => {
|
|
69
|
-
const pluginImportPaths = {};
|
|
70
|
-
return Object.values(plugins).filter((plugin) => {
|
|
71
|
-
if (!plugin) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
try {
|
|
75
|
-
const localPluginPath = plugin.path;
|
|
76
|
-
if (localPluginPath) {
|
|
77
|
-
const packageJsonPath = path.join(localPluginPath, "package.json");
|
|
78
|
-
if (fs.existsSync(packageJsonPath)) {
|
|
79
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
80
|
-
const localAdminPath = packageJson?.exports?.["./strapi-admin"]?.import;
|
|
81
|
-
if (localAdminPath) {
|
|
82
|
-
pluginImportPaths[plugin.modulePath] = localAdminPath;
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (fs.existsSync(path.join(localPluginPath, "strapi-admin.js"))) {
|
|
87
|
-
pluginImportPaths[plugin.modulePath] = "strapi-admin";
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (require.resolve(`${plugin.modulePath}/strapi-admin`)) {
|
|
92
|
-
pluginImportPaths[plugin.modulePath] = "strapi-admin";
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
return false;
|
|
96
|
-
} catch (err) {
|
|
97
|
-
if (isError(err) && "code" in err && (err.code === "MODULE_NOT_FOUND" || err.code === "ERR_PACKAGE_PATH_NOT_EXPORTED")) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
throw err;
|
|
101
|
-
}
|
|
102
|
-
}).map((plugin) => ({
|
|
103
|
-
...plugin,
|
|
104
|
-
modulePath: `${plugin.modulePath}/${pluginImportPaths[plugin.modulePath]}`
|
|
105
|
-
}));
|
|
106
|
-
};
|
|
107
|
-
export {
|
|
108
|
-
getEnabledPlugins,
|
|
109
|
-
getMapOfPluginsWithAdmin
|
|
110
|
-
};
|
|
111
|
-
//# sourceMappingURL=plugins.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.mjs","sources":["../../../src/node/core/plugins.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport camelCase from 'lodash/camelCase';\nimport { env } from '@strapi/utils';\nimport { getModule, PackageJson } from './dependencies';\nimport { convertModulePathToSystemPath, convertSystemPathToModulePath, loadFile } from './files';\nimport type { BaseContext } from '../types';\nimport { isError } from './errors';\n\ninterface LocalPluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * The path to the plugin, relative to the app's root directory\n * in system format\n */\n path: string;\n /**\n * The path to the plugin, relative to the runtime directory\n * in module format (i.e. with forward slashes) because thats\n * where it should be used as an import\n */\n modulePath: string;\n type: 'local';\n}\n\ninterface ModulePluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * Modules don't have a path because we never resolve them to their node_modules\n * because we simply do not require it.\n */\n path?: never;\n /**\n * The path to the plugin, relative to the app's root directory\n * in module format (i.e. with forward slashes)\n */\n modulePath: string;\n type: 'module';\n}\n\ntype PluginMeta = LocalPluginMeta | ModulePluginMeta;\n\ninterface StrapiPlugin extends PackageJson {\n strapi: {\n description?: string;\n displayName?: string;\n kind: 'plugin';\n name?: string;\n required?: boolean;\n };\n}\n\nconst validatePackageHasStrapi = (\n pkg: PackageJson\n): pkg is PackageJson & { strapi: Record<string, unknown> } =>\n 'strapi' in pkg &&\n typeof pkg.strapi === 'object' &&\n !Array.isArray(pkg.strapi) &&\n pkg.strapi !== null;\n\nconst validatePackageIsPlugin = (pkg: PackageJson): pkg is StrapiPlugin =>\n validatePackageHasStrapi(pkg) && pkg.strapi.kind === 'plugin';\n\nconst getEnabledPlugins = async ({\n cwd,\n logger,\n runtimeDir,\n strapi,\n}: Pick<BaseContext, 'cwd' | 'logger' | 'strapi' | 'runtimeDir'>): Promise<\n Record<string, PluginMeta>\n> => {\n const plugins: Record<string, PluginMeta> = {};\n\n /**\n * This is the list of dependencies that are installed in the user's project.\n * It will include libraries like \"react\", so we need to collect the ones that\n * are plugins.\n */\n const deps = strapi.config.get('info.dependencies', {});\n\n logger.debug(\"Dependencies from user's project\", os.EOL, deps);\n\n for (const dep of Object.keys(deps)) {\n const pkg = await getModule(dep, cwd);\n\n if (pkg && validatePackageIsPlugin(pkg)) {\n const name = pkg.strapi.name || pkg.name;\n\n if (!name) {\n /**\n * Unlikely to happen, but you never know.\n */\n throw Error(\n \"You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!\"\n );\n }\n\n plugins[name] = {\n name,\n importName: camelCase(name),\n type: 'module',\n modulePath: dep,\n };\n }\n }\n\n const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);\n\n logger.debug(\"User's plugins file\", os.EOL, userPluginsFile);\n\n for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)) {\n if (userPluginConfig.enabled && userPluginConfig.resolve) {\n const sysPath = convertModulePathToSystemPath(userPluginConfig.resolve);\n plugins[userPluginName] = {\n name: userPluginName,\n importName: camelCase(userPluginName),\n type: 'local',\n /**\n * User plugin paths are resolved from the entry point\n * of the app, because that's how you import them.\n */\n modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, sysPath)),\n path: sysPath,\n };\n }\n }\n\n return plugins;\n};\n\nconst PLUGIN_CONFIGS = ['plugins.js', 'plugins.mjs', 'plugins.ts'];\n\ntype UserPluginConfigFile = Record<string, { enabled: boolean; resolve: string }>;\n\nconst loadUserPluginsFile = async (root: string): Promise<UserPluginConfigFile> => {\n for (const file of PLUGIN_CONFIGS) {\n const filePath = path.join(root, file);\n const configFile = await loadFile(filePath);\n\n if (configFile) {\n /**\n * Configs can be a function or they can be just an object!\n */\n return typeof configFile === 'function' ? configFile({ env }) : configFile;\n }\n }\n\n return {};\n};\n\nconst getMapOfPluginsWithAdmin = (plugins: Record<string, PluginMeta>) => {\n /**\n * This variable stores the import paths for plugins.\n * The keys are the module paths of the plugins, and the values are the paths\n * to the admin part of the plugins, which is either loaded from the\n * package.json exports or from the legacy strapi-admin.js file.\n */\n const pluginImportPaths: Record<string, string> = {};\n\n return Object.values(plugins)\n .filter((plugin) => {\n if (!plugin) {\n return false;\n }\n\n /**\n * There are two ways a plugin should be imported, either it's local to the strapi app,\n * or it's an actual npm module that's installed and resolved via node_modules.\n *\n * We first check if the plugin is local to the strapi app, using a regular `fs.existsSync` because\n * the pathToPlugin will be relative i.e. `/Users/my-name/strapi-app/src/plugins/my-plugin`.\n *\n * If the file doesn't exist well then it's probably a node_module, so instead we use `require.resolve`\n * which will resolve the path to the module in node_modules. If it fails with the specific code `MODULE_NOT_FOUND`\n * then it doesn't have an admin part to the package.\n */\n try {\n const localPluginPath = plugin.path;\n if (localPluginPath) {\n // Here we are loading a locally installed plugin\n const packageJsonPath = path.join(localPluginPath, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n const localAdminPath = packageJson?.exports?.['./strapi-admin']?.import;\n\n if (localAdminPath) {\n pluginImportPaths[plugin.modulePath] = localAdminPath;\n return true;\n }\n }\n\n // Check if legacy admin file exists in local plugin\n if (fs.existsSync(path.join(localPluginPath, 'strapi-admin.js'))) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n }\n\n // This plugin is a module, so we need to check if it has a strapi-admin export\n if (require.resolve(`${plugin.modulePath}/strapi-admin`)) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n\n return false;\n } catch (err) {\n if (\n isError(err) &&\n 'code' in err &&\n (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')\n ) {\n /**\n * the plugin does not contain FE code, so we\n * don't want to import it anyway\n */\n return false;\n }\n\n throw err;\n }\n })\n .map((plugin) => ({\n ...plugin,\n modulePath: `${plugin.modulePath}/${pluginImportPaths[plugin.modulePath]}`,\n }));\n};\n\nexport { getEnabledPlugins, getMapOfPluginsWithAdmin };\nexport type { PluginMeta, LocalPluginMeta, ModulePluginMeta };\n"],"names":[],"mappings":"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"}
|
package/dist/node/core/timer.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const perf_hooks = require("perf_hooks");
|
|
4
|
-
function getTimer() {
|
|
5
|
-
const timings = {};
|
|
6
|
-
const startTimes = {};
|
|
7
|
-
function start(name) {
|
|
8
|
-
if (typeof startTimes[name] !== "undefined") {
|
|
9
|
-
throw new Error(`Timer "${name}" already started, cannot overwrite`);
|
|
10
|
-
}
|
|
11
|
-
startTimes[name] = perf_hooks.performance.now();
|
|
12
|
-
}
|
|
13
|
-
function end(name) {
|
|
14
|
-
if (typeof startTimes[name] === "undefined") {
|
|
15
|
-
throw new Error(`Timer "${name}" never started, cannot end`);
|
|
16
|
-
}
|
|
17
|
-
timings[name] = perf_hooks.performance.now() - startTimes[name];
|
|
18
|
-
return timings[name];
|
|
19
|
-
}
|
|
20
|
-
return { start, end, getTimings: () => timings };
|
|
21
|
-
}
|
|
22
|
-
const prettyTime = (timeInMs) => {
|
|
23
|
-
return `${Math.ceil(timeInMs)}ms`;
|
|
24
|
-
};
|
|
25
|
-
exports.getTimer = getTimer;
|
|
26
|
-
exports.prettyTime = prettyTime;
|
|
27
|
-
//# sourceMappingURL=timer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timer.js","sources":["../../../src/node/core/timer.ts"],"sourcesContent":["import { performance } from 'perf_hooks';\n\nexport interface TimeMeasurer {\n start: (name: string) => void;\n end: (name: string) => number;\n getTimings: () => Record<string, number>;\n}\n\nexport function getTimer(): TimeMeasurer {\n const timings: Record<string, number> = {};\n const startTimes: Record<string, number> = {};\n\n function start(name: string): void {\n if (typeof startTimes[name] !== 'undefined') {\n throw new Error(`Timer \"${name}\" already started, cannot overwrite`);\n }\n\n startTimes[name] = performance.now();\n }\n\n function end(name: string): number {\n if (typeof startTimes[name] === 'undefined') {\n throw new Error(`Timer \"${name}\" never started, cannot end`);\n }\n\n timings[name] = performance.now() - startTimes[name];\n return timings[name];\n }\n\n return { start, end, getTimings: () => timings };\n}\n\nexport const prettyTime = (timeInMs: number): string => {\n return `${Math.ceil(timeInMs)}ms`;\n};\n"],"names":["performance"],"mappings":";;;AAQO,SAAS,WAAyB;AACvC,QAAM,UAAkC,CAAC;AACzC,QAAM,aAAqC,CAAC;AAE5C,WAAS,MAAM,MAAoB;AACjC,QAAI,OAAO,WAAW,IAAI,MAAM,aAAa;AAC3C,YAAM,IAAI,MAAM,UAAU,IAAI,qCAAqC;AAAA,IAAA;AAG1D,eAAA,IAAI,IAAIA,WAAA,YAAY,IAAI;AAAA,EAAA;AAGrC,WAAS,IAAI,MAAsB;AACjC,QAAI,OAAO,WAAW,IAAI,MAAM,aAAa;AAC3C,YAAM,IAAI,MAAM,UAAU,IAAI,6BAA6B;AAAA,IAAA;AAG7D,YAAQ,IAAI,IAAIA,WAAAA,YAAY,IAAI,IAAI,WAAW,IAAI;AACnD,WAAO,QAAQ,IAAI;AAAA,EAAA;AAGrB,SAAO,EAAE,OAAO,KAAK,YAAY,MAAM,QAAQ;AACjD;AAEa,MAAA,aAAa,CAAC,aAA6B;AACtD,SAAO,GAAG,KAAK,KAAK,QAAQ,CAAC;AAC/B;;;"}
|
package/dist/node/core/timer.mjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { performance } from "perf_hooks";
|
|
2
|
-
function getTimer() {
|
|
3
|
-
const timings = {};
|
|
4
|
-
const startTimes = {};
|
|
5
|
-
function start(name) {
|
|
6
|
-
if (typeof startTimes[name] !== "undefined") {
|
|
7
|
-
throw new Error(`Timer "${name}" already started, cannot overwrite`);
|
|
8
|
-
}
|
|
9
|
-
startTimes[name] = performance.now();
|
|
10
|
-
}
|
|
11
|
-
function end(name) {
|
|
12
|
-
if (typeof startTimes[name] === "undefined") {
|
|
13
|
-
throw new Error(`Timer "${name}" never started, cannot end`);
|
|
14
|
-
}
|
|
15
|
-
timings[name] = performance.now() - startTimes[name];
|
|
16
|
-
return timings[name];
|
|
17
|
-
}
|
|
18
|
-
return { start, end, getTimings: () => timings };
|
|
19
|
-
}
|
|
20
|
-
const prettyTime = (timeInMs) => {
|
|
21
|
-
return `${Math.ceil(timeInMs)}ms`;
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
getTimer,
|
|
25
|
-
prettyTime
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=timer.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timer.mjs","sources":["../../../src/node/core/timer.ts"],"sourcesContent":["import { performance } from 'perf_hooks';\n\nexport interface TimeMeasurer {\n start: (name: string) => void;\n end: (name: string) => number;\n getTimings: () => Record<string, number>;\n}\n\nexport function getTimer(): TimeMeasurer {\n const timings: Record<string, number> = {};\n const startTimes: Record<string, number> = {};\n\n function start(name: string): void {\n if (typeof startTimes[name] !== 'undefined') {\n throw new Error(`Timer \"${name}\" already started, cannot overwrite`);\n }\n\n startTimes[name] = performance.now();\n }\n\n function end(name: string): number {\n if (typeof startTimes[name] === 'undefined') {\n throw new Error(`Timer \"${name}\" never started, cannot end`);\n }\n\n timings[name] = performance.now() - startTimes[name];\n return timings[name];\n }\n\n return { start, end, getTimings: () => timings };\n}\n\nexport const prettyTime = (timeInMs: number): string => {\n return `${Math.ceil(timeInMs)}ms`;\n};\n"],"names":[],"mappings":";AAQO,SAAS,WAAyB;AACvC,QAAM,UAAkC,CAAC;AACzC,QAAM,aAAqC,CAAC;AAE5C,WAAS,MAAM,MAAoB;AACjC,QAAI,OAAO,WAAW,IAAI,MAAM,aAAa;AAC3C,YAAM,IAAI,MAAM,UAAU,IAAI,qCAAqC;AAAA,IAAA;AAG1D,eAAA,IAAI,IAAI,YAAY,IAAI;AAAA,EAAA;AAGrC,WAAS,IAAI,MAAsB;AACjC,QAAI,OAAO,WAAW,IAAI,MAAM,aAAa;AAC3C,YAAM,IAAI,MAAM,UAAU,IAAI,6BAA6B;AAAA,IAAA;AAG7D,YAAQ,IAAI,IAAI,YAAY,IAAI,IAAI,WAAW,IAAI;AACnD,WAAO,QAAQ,IAAI;AAAA,EAAA;AAGrB,SAAO,EAAE,OAAO,KAAK,YAAY,MAAM,QAAQ;AACjD;AAEa,MAAA,aAAa,CAAC,aAA6B;AACtD,SAAO,GAAG,KAAK,KAAK,QAAQ,CAAC;AAC/B;"}
|