@strapi/strapi 4.15.0 → 4.15.2
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.d.ts +5 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +23 -0
- package/dist/admin.js.map +1 -0
- package/dist/admin.mjs +19 -0
- package/dist/admin.mjs.map +1 -0
- package/dist/commands/actions/plugin/build-command/action.d.ts.map +1 -1
- package/dist/commands/actions/plugin/build-command/action.js +1 -0
- package/dist/commands/actions/plugin/build-command/action.js.map +1 -1
- package/dist/commands/actions/watch-admin/action.d.ts +4 -2
- package/dist/commands/actions/watch-admin/action.d.ts.map +1 -1
- package/dist/commands/actions/watch-admin/action.js +5 -30
- package/dist/commands/actions/watch-admin/action.js.map +1 -1
- package/dist/commands/actions/watch-admin/command.d.ts.map +1 -1
- package/dist/commands/actions/watch-admin/command.js.map +1 -1
- package/dist/commands/index.d.ts +4 -3
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +75 -57
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/types.d.ts +8 -0
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/utils/logger.d.ts +2 -0
- package/dist/commands/utils/logger.d.ts.map +1 -1
- package/dist/commands/utils/logger.js +20 -0
- package/dist/commands/utils/logger.js.map +1 -1
- package/dist/commands/utils/tsconfig.d.ts +19 -0
- package/dist/commands/utils/tsconfig.d.ts.map +1 -0
- package/dist/commands/utils/tsconfig.js +26 -0
- package/dist/commands/utils/tsconfig.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/services/server/http-server.d.ts.map +1 -1
- package/dist/services/server/http-server.js +2 -1
- package/dist/services/server/http-server.js.map +1 -1
- package/dist/services/server/http-server.mjs +2 -1
- package/dist/services/server/http-server.mjs.map +1 -1
- package/package.json +43 -30
- package/dist/commands/actions/build-command/action.d.ts +0 -10
- package/dist/commands/actions/build-command/action.d.ts.map +0 -1
- package/dist/commands/actions/build-command/action.js +0 -17
- package/dist/commands/actions/build-command/action.js.map +0 -1
- package/dist/commands/actions/build-command/command.d.ts +0 -7
- package/dist/commands/actions/build-command/command.d.ts.map +0 -1
- package/dist/commands/actions/build-command/command.js +0 -8
- package/dist/commands/actions/build-command/command.js.map +0 -1
- package/dist/commands/actions/develop/action.d.ts +0 -13
- package/dist/commands/actions/develop/action.d.ts.map +0 -1
- package/dist/commands/actions/develop/action.js +0 -197
- package/dist/commands/actions/develop/action.js.map +0 -1
- package/dist/commands/actions/develop/command.d.ts +0 -7
- package/dist/commands/actions/develop/command.d.ts.map +0 -1
- package/dist/commands/actions/develop/command.js +0 -8
- package/dist/commands/actions/develop/command.js.map +0 -1
- package/dist/commands/builders/admin.d.ts +0 -9
- package/dist/commands/builders/admin.d.ts.map +0 -1
- package/dist/commands/builders/admin.js +0 -48
- package/dist/commands/builders/admin.js.map +0 -1
- package/dist/commands/builders/index.d.ts +0 -4
- package/dist/commands/builders/index.d.ts.map +0 -1
- package/dist/commands/builders/typescript.d.ts +0 -7
- package/dist/commands/builders/typescript.d.ts.map +0 -1
- package/dist/commands/builders/typescript.js +0 -32
- package/dist/commands/builders/typescript.js.map +0 -1
- package/dist/utils/addSlash.js +0 -15
- package/dist/utils/addSlash.js.map +0 -1
package/dist/admin.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RenderAdminArgs } from '@strapi/admin/strapi-admin';
|
|
2
|
+
declare const render: (mountNode: HTMLElement | null, { plugins }: RenderAdminArgs) => Promise<void>;
|
|
3
|
+
export { render as renderAdmin };
|
|
4
|
+
export type { RenderAdminArgs };
|
|
5
|
+
//# sourceMappingURL=admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAe,MAAM,4BAA4B,CAAC;AAO1E,QAAA,MAAM,MAAM,cAAe,WAAW,GAAG,IAAI,eAAe,eAAe,kBAU1E,CAAC;AAEF,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,CAAC;AACjC,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
package/dist/admin.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
4
|
+
const contentTypeBuilder = require("@strapi/plugin-content-type-builder/strapi-admin");
|
|
5
|
+
const email = require("@strapi/plugin-email/strapi-admin");
|
|
6
|
+
const upload = require("@strapi/plugin-upload/strapi-admin");
|
|
7
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
8
|
+
const contentTypeBuilder__default = /* @__PURE__ */ _interopDefault(contentTypeBuilder);
|
|
9
|
+
const email__default = /* @__PURE__ */ _interopDefault(email);
|
|
10
|
+
const upload__default = /* @__PURE__ */ _interopDefault(upload);
|
|
11
|
+
const render = (mountNode, { plugins }) => {
|
|
12
|
+
return strapiAdmin.renderAdmin(mountNode, {
|
|
13
|
+
plugins: {
|
|
14
|
+
"content-type-builder": contentTypeBuilder__default.default,
|
|
15
|
+
// @ts-expect-error – TODO: fix this
|
|
16
|
+
email: email__default.default,
|
|
17
|
+
upload: upload__default.default,
|
|
18
|
+
...plugins
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
exports.renderAdmin = render;
|
|
23
|
+
//# sourceMappingURL=admin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.js","sources":["../src/admin.ts"],"sourcesContent":["import { RenderAdminArgs, renderAdmin } from '@strapi/admin/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport contentTypeBuilder from '@strapi/plugin-content-type-builder/strapi-admin';\nimport email from '@strapi/plugin-email/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport upload from '@strapi/plugin-upload/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n plugins: {\n 'content-type-builder': contentTypeBuilder,\n // @ts-expect-error – TODO: fix this\n email,\n upload,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs };\n"],"names":["renderAdmin","contentTypeBuilder","email","upload"],"mappings":";;;;;;;;;;AAOA,MAAM,SAAS,CAAC,WAA+B,EAAE,cAA+B;AAC9E,SAAOA,YAAAA,YAAY,WAAW;AAAA,IAC5B,SAAS;AAAA,MACP,wBAAwBC,4BAAA;AAAA;AAAA,MAAA,OAExBC,eAAA;AAAA,MAAA,QACAC,gBAAA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,EAAA,CACD;AACH;;"}
|
package/dist/admin.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { renderAdmin } from "@strapi/admin/strapi-admin";
|
|
2
|
+
import contentTypeBuilder from "@strapi/plugin-content-type-builder/strapi-admin";
|
|
3
|
+
import email from "@strapi/plugin-email/strapi-admin";
|
|
4
|
+
import upload from "@strapi/plugin-upload/strapi-admin";
|
|
5
|
+
const render = (mountNode, { plugins }) => {
|
|
6
|
+
return renderAdmin(mountNode, {
|
|
7
|
+
plugins: {
|
|
8
|
+
"content-type-builder": contentTypeBuilder,
|
|
9
|
+
// @ts-expect-error – TODO: fix this
|
|
10
|
+
email,
|
|
11
|
+
upload,
|
|
12
|
+
...plugins
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
render as renderAdmin
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=admin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.mjs","sources":["../src/admin.ts"],"sourcesContent":["import { RenderAdminArgs, renderAdmin } from '@strapi/admin/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport contentTypeBuilder from '@strapi/plugin-content-type-builder/strapi-admin';\nimport email from '@strapi/plugin-email/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport upload from '@strapi/plugin-upload/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n plugins: {\n 'content-type-builder': contentTypeBuilder,\n // @ts-expect-error – TODO: fix this\n email,\n upload,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs };\n"],"names":[],"mappings":";;;;AAOA,MAAM,SAAS,CAAC,WAA+B,EAAE,cAA+B;AAC9E,SAAO,YAAY,WAAW;AAAA,IAC5B,SAAS;AAAA,MACP,wBAAwB;AAAA;AAAA,MAExB;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,EAAA,CACD;AACH;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../../src/commands/actions/plugin/build-command/action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAuB,MAAM,iBAAiB,CAAC;AAKvE,UAAU,aAAc,SAAQ,eAAe;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;6CAEyC,aAAa;AAAvD,
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../../src/commands/actions/plugin/build-command/action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAuB,MAAM,iBAAiB,CAAC;AAKvE,UAAU,aAAc,SAAQ,eAAe;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;6CAEyC,aAAa;AAAvD,wBA+FE"}
|
|
@@ -11,6 +11,7 @@ const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
|
|
|
11
11
|
const action = async ({ force, ...opts }) => {
|
|
12
12
|
const logger$1 = logger.createLogger({ debug: opts.debug, silent: opts.silent, timestamp: false });
|
|
13
13
|
try {
|
|
14
|
+
process.env.NODE_ENV = "production";
|
|
14
15
|
await helpers.notifyExperimentalCommand("plugin:build", { force });
|
|
15
16
|
const cwd = process.cwd();
|
|
16
17
|
const pkg$1 = await pkg.loadPkg({ cwd, logger: logger$1 });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/plugin/build-command/action.ts"],"sourcesContent":["import boxen from 'boxen';\nimport chalk from 'chalk';\nimport { BuildCLIOptions, ConfigBundle, build } from '@strapi/pack-up';\nimport { notifyExperimentalCommand } from '../../../utils/helpers';\nimport { createLogger } from '../../../utils/logger';\nimport { Export, loadPkg, validatePkg } from '../../../utils/pkg';\n\ninterface ActionOptions extends BuildCLIOptions {\n force?: boolean;\n}\n\nexport default async ({ force, ...opts }: ActionOptions) => {\n const logger = createLogger({ debug: opts.debug, silent: opts.silent, timestamp: false });\n try {\n /**\n * Notify users this is an experimental command and get them to approve first\n * this can be opted out by setting the argument --yes\n */\n await notifyExperimentalCommand('plugin:build', { force });\n\n const cwd = process.cwd();\n\n const pkg = await loadPkg({ cwd, logger });\n const pkgJson = await validatePkg({ pkg });\n\n if (!pkgJson.exports['./strapi-admin'] && !pkgJson.exports['./strapi-server']) {\n throw new Error(\n 'You need to have either a strapi-admin or strapi-server export in your package.json'\n );\n }\n\n const bundles: ConfigBundle[] = [];\n\n if (pkgJson.exports['./strapi-admin']) {\n const exp = pkgJson.exports['./strapi-admin'] as Export;\n\n const bundle: ConfigBundle = {\n source: exp.source,\n import: exp.import,\n require: exp.require,\n runtime: 'web',\n };\n\n if (exp.types) {\n bundle.types = exp.types;\n // TODO: should this be sliced from the source path...?\n bundle.tsconfig = './admin/tsconfig.build.json';\n }\n\n bundles.push(bundle);\n }\n\n if (pkgJson.exports['./strapi-server']) {\n const exp = pkgJson.exports['./strapi-server'] as Export;\n\n const bundle: ConfigBundle = {\n source: exp.source,\n import: exp.import,\n require: exp.require,\n runtime: 'node',\n };\n\n if (exp.types) {\n bundle.types = exp.types;\n // TODO: should this be sliced from the source path...?\n bundle.tsconfig = './server/tsconfig.build.json';\n }\n\n bundles.push(bundle);\n }\n\n await build({\n cwd,\n configFile: false,\n config: {\n bundles,\n dist: './dist',\n /**\n * ignore the exports map of a plugin, because we're streamlining the\n * process and ensuring the server package and admin package are built\n * with the correct runtime and their individual tsconfigs\n */\n exports: {},\n },\n ...opts,\n });\n } catch (err) {\n logger.error(\n 'There seems to be an unexpected error, try again with --debug for more information \\n'\n );\n if (err instanceof Error && err.stack) {\n console.log(\n chalk.red(\n boxen(err.stack, {\n padding: 1,\n align: 'left',\n })\n )\n );\n }\n process.exit(1);\n }\n};\n"],"names":["logger","createLogger","notifyExperimentalCommand","pkg","loadPkg","validatePkg","build","chalk","boxen"],"mappings":";;;;;;;;;;AAWA,MAAA,SAAe,OAAO,EAAE,OAAO,GAAG,WAA0B;AACpD,QAAAA,WAASC,OAAAA,aAAa,EAAE,OAAO,KAAK,OAAO,QAAQ,KAAK,QAAQ,WAAW,MAAO,CAAA;AACpF,MAAA;
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/plugin/build-command/action.ts"],"sourcesContent":["import boxen from 'boxen';\nimport chalk from 'chalk';\nimport { BuildCLIOptions, ConfigBundle, build } from '@strapi/pack-up';\nimport { notifyExperimentalCommand } from '../../../utils/helpers';\nimport { createLogger } from '../../../utils/logger';\nimport { Export, loadPkg, validatePkg } from '../../../utils/pkg';\n\ninterface ActionOptions extends BuildCLIOptions {\n force?: boolean;\n}\n\nexport default async ({ force, ...opts }: ActionOptions) => {\n const logger = createLogger({ debug: opts.debug, silent: opts.silent, timestamp: false });\n try {\n /**\n * ALWAYS set production for using plugin build CLI.\n */\n process.env.NODE_ENV = 'production';\n /**\n * Notify users this is an experimental command and get them to approve first\n * this can be opted out by setting the argument --yes\n */\n await notifyExperimentalCommand('plugin:build', { force });\n\n const cwd = process.cwd();\n\n const pkg = await loadPkg({ cwd, logger });\n const pkgJson = await validatePkg({ pkg });\n\n if (!pkgJson.exports['./strapi-admin'] && !pkgJson.exports['./strapi-server']) {\n throw new Error(\n 'You need to have either a strapi-admin or strapi-server export in your package.json'\n );\n }\n\n const bundles: ConfigBundle[] = [];\n\n if (pkgJson.exports['./strapi-admin']) {\n const exp = pkgJson.exports['./strapi-admin'] as Export;\n\n const bundle: ConfigBundle = {\n source: exp.source,\n import: exp.import,\n require: exp.require,\n runtime: 'web',\n };\n\n if (exp.types) {\n bundle.types = exp.types;\n // TODO: should this be sliced from the source path...?\n bundle.tsconfig = './admin/tsconfig.build.json';\n }\n\n bundles.push(bundle);\n }\n\n if (pkgJson.exports['./strapi-server']) {\n const exp = pkgJson.exports['./strapi-server'] as Export;\n\n const bundle: ConfigBundle = {\n source: exp.source,\n import: exp.import,\n require: exp.require,\n runtime: 'node',\n };\n\n if (exp.types) {\n bundle.types = exp.types;\n // TODO: should this be sliced from the source path...?\n bundle.tsconfig = './server/tsconfig.build.json';\n }\n\n bundles.push(bundle);\n }\n\n await build({\n cwd,\n configFile: false,\n config: {\n bundles,\n dist: './dist',\n /**\n * ignore the exports map of a plugin, because we're streamlining the\n * process and ensuring the server package and admin package are built\n * with the correct runtime and their individual tsconfigs\n */\n exports: {},\n },\n ...opts,\n });\n } catch (err) {\n logger.error(\n 'There seems to be an unexpected error, try again with --debug for more information \\n'\n );\n if (err instanceof Error && err.stack) {\n console.log(\n chalk.red(\n boxen(err.stack, {\n padding: 1,\n align: 'left',\n })\n )\n );\n }\n process.exit(1);\n }\n};\n"],"names":["logger","createLogger","notifyExperimentalCommand","pkg","loadPkg","validatePkg","build","chalk","boxen"],"mappings":";;;;;;;;;;AAWA,MAAA,SAAe,OAAO,EAAE,OAAO,GAAG,WAA0B;AACpD,QAAAA,WAASC,OAAAA,aAAa,EAAE,OAAO,KAAK,OAAO,QAAQ,KAAK,QAAQ,WAAW,MAAO,CAAA;AACpF,MAAA;AAIF,YAAQ,IAAI,WAAW;AAKvB,UAAMC,kCAA0B,gBAAgB,EAAE,MAAO,CAAA;AAEnD,UAAA,MAAM,QAAQ;AAEpB,UAAMC,QAAM,MAAMC,IAAA,QAAQ,EAAE,KAAKJ,QAAAA,SAAQ,CAAA;AACzC,UAAM,UAAU,MAAMK,IAAAA,YAAY,EAAEF,KAAAA,MAAK,CAAA;AAErC,QAAA,CAAC,QAAQ,QAAQ,gBAAgB,KAAK,CAAC,QAAQ,QAAQ,iBAAiB,GAAG;AAC7E,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAM,UAA0B,CAAA;AAE5B,QAAA,QAAQ,QAAQ,gBAAgB,GAAG;AAC/B,YAAA,MAAM,QAAQ,QAAQ,gBAAgB;AAE5C,YAAM,SAAuB;AAAA,QAC3B,QAAQ,IAAI;AAAA,QACZ,QAAQ,IAAI;AAAA,QACZ,SAAS,IAAI;AAAA,QACb,SAAS;AAAA,MAAA;AAGX,UAAI,IAAI,OAAO;AACb,eAAO,QAAQ,IAAI;AAEnB,eAAO,WAAW;AAAA,MACpB;AAEA,cAAQ,KAAK,MAAM;AAAA,IACrB;AAEI,QAAA,QAAQ,QAAQ,iBAAiB,GAAG;AAChC,YAAA,MAAM,QAAQ,QAAQ,iBAAiB;AAE7C,YAAM,SAAuB;AAAA,QAC3B,QAAQ,IAAI;AAAA,QACZ,QAAQ,IAAI;AAAA,QACZ,SAAS,IAAI;AAAA,QACb,SAAS;AAAA,MAAA;AAGX,UAAI,IAAI,OAAO;AACb,eAAO,QAAQ,IAAI;AAEnB,eAAO,WAAW;AAAA,MACpB;AAEA,cAAQ,KAAK,MAAM;AAAA,IACrB;AAEA,UAAMG,aAAM;AAAA,MACV;AAAA,MACA,YAAY;AAAA,MACZ,QAAQ;AAAA,QACN;AAAA,QACA,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMN,SAAS,CAAC;AAAA,MACZ;AAAA,MACA,GAAG;AAAA,IAAA,CACJ;AAAA,WACM,KAAK;AACLN,aAAA;AAAA,MACL;AAAA,IAAA;AAEE,QAAA,eAAe,SAAS,IAAI,OAAO;AAC7B,cAAA;AAAA,QACNO,eAAAA,QAAM;AAAA,UACJC,eAAA,QAAM,IAAI,OAAO;AAAA,YACf,SAAS;AAAA,YACT,OAAO;AAAA,UAAA,CACR;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;;"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { CLIContext } from '../../types';
|
|
2
|
+
interface WatchAdminOptions extends CLIContext {
|
|
2
3
|
browser: boolean;
|
|
3
|
-
}
|
|
4
|
+
}
|
|
5
|
+
declare const _default: ({ browser, logger }: WatchAdminOptions) => Promise<void>;
|
|
4
6
|
export default _default;
|
|
5
7
|
//# sourceMappingURL=action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/commands/actions/watch-admin/action.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/commands/actions/watch-admin/action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,UAAU,iBAAkB,SAAQ,UAAU;IAC5C,OAAO,EAAE,OAAO,CAAC;CAClB;8CAE0C,iBAAiB;AAA5D,wBAME"}
|
|
@@ -1,34 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
8
|
-
const strapiAdmin__default = /* @__PURE__ */ _interopDefault(strapiAdmin);
|
|
9
|
-
const action = async ({ browser }) => {
|
|
10
|
-
const appContext = await Strapi.compile();
|
|
11
|
-
const strapiInstance = Strapi({
|
|
12
|
-
...appContext,
|
|
13
|
-
autoReload: true,
|
|
14
|
-
serveAdminPanel: false
|
|
15
|
-
});
|
|
16
|
-
const plugins = await getEnabledPlugins.getEnabledPlugins(strapiInstance, { client: true });
|
|
17
|
-
const { adminPath } = strapiUtils.getConfigUrls(strapiInstance.config, true);
|
|
18
|
-
const adminPort = strapiInstance.config.get("admin.port", 8e3);
|
|
19
|
-
const adminHost = strapiInstance.config.get("admin.host", "localhost");
|
|
20
|
-
const backendURL = strapiUtils.getAbsoluteServerUrl(strapiInstance.config, true);
|
|
21
|
-
strapiAdmin__default.default.watchAdmin({
|
|
22
|
-
appDir: appContext.appDir,
|
|
23
|
-
buildDestDir: appContext.distDir,
|
|
24
|
-
plugins,
|
|
25
|
-
port: adminPort,
|
|
26
|
-
host: adminHost,
|
|
27
|
-
browser,
|
|
28
|
-
options: {
|
|
29
|
-
backend: backendURL,
|
|
30
|
-
adminPath: addSlash(adminPath)
|
|
31
|
-
}
|
|
2
|
+
const admin = require("@strapi/admin");
|
|
3
|
+
const action = async ({ browser, logger }) => {
|
|
4
|
+
logger.warn("[@strapi/strapi]: watch-admin is deprecated, please use strapi develop instead");
|
|
5
|
+
await admin.watchAdmin({
|
|
6
|
+
browser
|
|
32
7
|
});
|
|
33
8
|
};
|
|
34
9
|
module.exports = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../src/commands/actions/watch-admin/action.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../src/commands/actions/watch-admin/action.ts"],"sourcesContent":["import { watchAdmin } from '@strapi/admin';\nimport { CLIContext } from '../../types';\n\ninterface WatchAdminOptions extends CLIContext {\n browser: boolean;\n}\n\nexport default async ({ browser, logger }: WatchAdminOptions) => {\n logger.warn('[@strapi/strapi]: watch-admin is deprecated, please use strapi develop instead');\n\n await watchAdmin({\n browser,\n });\n};\n"],"names":["watchAdmin"],"mappings":";;AAOA,MAAA,SAAe,OAAO,EAAE,SAAS,aAAgC;AAC/D,SAAO,KAAK,gFAAgF;AAE5F,QAAMA,iBAAW;AAAA,IACf;AAAA,EAAA,CACD;AACH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/commands/actions/watch-admin/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/commands/actions/watch-admin/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD;;GAEG;AACH,QAAA,MAAM,OAAO,EAAE,aAMd,CAAC;AACF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../src/commands/actions/watch-admin/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport action from './action';\n
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../src/commands/actions/watch-admin/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport action from './action';\n/**\n * `$ strapi watch-admin`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('watch-admin')\n .option('--browser <name>', 'Open the browser', true)\n .description('Start the admin development server')\n .action(runAction('watch-admin', action));\n};\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAMA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,aAAa,EACrB,OAAO,oBAAoB,oBAAoB,IAAI,EACnD,YAAY,oCAAoC,EAChD,OAAOC,QAAU,UAAA,eAAe,MAAM,CAAC;AAC5C;;"}
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -2,14 +2,12 @@ import { Command } from 'commander';
|
|
|
2
2
|
declare const strapiCommands: {
|
|
3
3
|
readonly createAdminUser: import("./types").StrapiCommand;
|
|
4
4
|
readonly resetAdminUserPassword: import("./types").StrapiCommand;
|
|
5
|
-
readonly buildCommand: import("./types").StrapiCommand;
|
|
6
5
|
readonly listComponents: import("./types").StrapiCommand;
|
|
7
6
|
readonly configurationDump: import("./types").StrapiCommand;
|
|
8
7
|
readonly configurationRestore: import("./types").StrapiCommand;
|
|
9
8
|
readonly consoleCommand: import("./types").StrapiCommand;
|
|
10
9
|
readonly listContentTypes: import("./types").StrapiCommand;
|
|
11
10
|
readonly listControllers: import("./types").StrapiCommand;
|
|
12
|
-
readonly developCommand: import("./types").StrapiCommand;
|
|
13
11
|
readonly generateCommand: import("./types").StrapiCommand;
|
|
14
12
|
readonly listHooks: import("./types").StrapiCommand;
|
|
15
13
|
readonly installCommand: import("./types").StrapiCommand;
|
|
@@ -27,10 +25,13 @@ declare const strapiCommands: {
|
|
|
27
25
|
readonly uninstallCommand: import("./types").StrapiCommand;
|
|
28
26
|
readonly versionCommand: import("./types").StrapiCommand;
|
|
29
27
|
readonly watchAdminCommand: import("./types").StrapiCommand;
|
|
28
|
+
/**
|
|
29
|
+
* Plugins
|
|
30
|
+
*/
|
|
30
31
|
readonly buildPluginCommand: import("./types").StrapiCommand;
|
|
31
32
|
readonly watchPluginCommand: import("./types").StrapiCommand;
|
|
32
33
|
};
|
|
33
|
-
declare const buildStrapiCommand: (argv: string[], command?: Command) => Command
|
|
34
|
+
declare const buildStrapiCommand: (argv: string[], command?: Command) => Promise<Command>;
|
|
34
35
|
declare const runStrapiCommand: (argv?: string[], command?: Command) => Promise<void>;
|
|
35
36
|
export { runStrapiCommand, buildStrapiCommand, strapiCommands };
|
|
36
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmCpC,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;IA0BlB;;OAEG;;;CAGK,CAAC;AAEX,QAAA,MAAM,kBAAkB,SAAgB,MAAM,EAAE,wCAoD/C,CAAC;AAEF,QAAA,MAAM,gBAAgB,uDAGrB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/commands/index.js
CHANGED
|
@@ -25,77 +25,94 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
25
25
|
const commander = require("commander");
|
|
26
26
|
const command = require("./actions/admin/create-user/command.js");
|
|
27
27
|
const command$1 = require("./actions/admin/reset-user-password/command.js");
|
|
28
|
-
const command$2 = require("./actions/
|
|
29
|
-
const command$3 = require("./actions/
|
|
30
|
-
const command$4 = require("./actions/configuration/
|
|
31
|
-
const command$5 = require("./actions/
|
|
32
|
-
const command$6 = require("./actions/
|
|
33
|
-
const command$7 = require("./actions/
|
|
34
|
-
const command$8 = require("./actions/
|
|
35
|
-
const command$9 = require("./actions/
|
|
36
|
-
const command$a = require("./actions/
|
|
37
|
-
const command$b = require("./actions/
|
|
38
|
-
const command$c = require("./actions/
|
|
39
|
-
const command$d = require("./actions/
|
|
40
|
-
const command$e = require("./actions/
|
|
41
|
-
const command$f = require("./actions/
|
|
42
|
-
const command$g = require("./actions/
|
|
43
|
-
const command$h = require("./actions/
|
|
44
|
-
const command$i = require("./actions/
|
|
45
|
-
const command$j = require("./actions/
|
|
46
|
-
const command$k = require("./actions/
|
|
47
|
-
const command$l = require("./actions/
|
|
48
|
-
const command$m = require("./actions/
|
|
49
|
-
const command$n = require("./actions/
|
|
50
|
-
const command$o = require("./actions/
|
|
51
|
-
const command$p = require("./actions/
|
|
52
|
-
const command$q = require("./actions/watch
|
|
53
|
-
const
|
|
54
|
-
const
|
|
28
|
+
const command$2 = require("./actions/components/list/command.js");
|
|
29
|
+
const command$3 = require("./actions/configuration/dump/command.js");
|
|
30
|
+
const command$4 = require("./actions/configuration/restore/command.js");
|
|
31
|
+
const command$5 = require("./actions/console/command.js");
|
|
32
|
+
const command$6 = require("./actions/content-types/list/command.js");
|
|
33
|
+
const command$7 = require("./actions/controllers/list/command.js");
|
|
34
|
+
const command$8 = require("./actions/generate/command.js");
|
|
35
|
+
const command$9 = require("./actions/hooks/list/command.js");
|
|
36
|
+
const command$a = require("./actions/install/command.js");
|
|
37
|
+
const command$b = require("./actions/middlewares/list/command.js");
|
|
38
|
+
const command$c = require("./actions/new/command.js");
|
|
39
|
+
const command$d = require("./actions/policies/list/command.js");
|
|
40
|
+
const command$e = require("./actions/report/command.js");
|
|
41
|
+
const command$f = require("./actions/routes/list/command.js");
|
|
42
|
+
const command$g = require("./actions/services/list/command.js");
|
|
43
|
+
const command$h = require("./actions/start/command.js");
|
|
44
|
+
const command$i = require("./actions/telemetry/disable/command.js");
|
|
45
|
+
const command$j = require("./actions/telemetry/enable/command.js");
|
|
46
|
+
const command$k = require("./actions/templates/generate/command.js");
|
|
47
|
+
const command$l = require("./actions/ts/generate-types/command.js");
|
|
48
|
+
const command$m = require("./actions/uninstall/command.js");
|
|
49
|
+
const command$n = require("./actions/version/command.js");
|
|
50
|
+
const command$o = require("./actions/watch-admin/command.js");
|
|
51
|
+
const command$p = require("./actions/plugin/build-command/command.js");
|
|
52
|
+
const command$q = require("./actions/plugin/watch/command.js");
|
|
53
|
+
const logger = require("./utils/logger.js");
|
|
54
|
+
const tsconfig = require("./utils/tsconfig.js");
|
|
55
55
|
const strapiCommands = {
|
|
56
56
|
createAdminUser: command,
|
|
57
57
|
resetAdminUserPassword: command$1,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
58
|
+
listComponents: command$2,
|
|
59
|
+
configurationDump: command$3,
|
|
60
|
+
configurationRestore: command$4,
|
|
61
|
+
consoleCommand: command$5,
|
|
62
|
+
listContentTypes: command$6,
|
|
63
|
+
listControllers: command$7,
|
|
64
|
+
generateCommand: command$8,
|
|
65
|
+
listHooks: command$9,
|
|
66
|
+
installCommand: command$a,
|
|
67
|
+
listMiddlewares: command$b,
|
|
68
|
+
newCommand: command$c,
|
|
69
|
+
listPolicies: command$d,
|
|
70
|
+
reportCommand: command$e,
|
|
71
|
+
listRoutes: command$f,
|
|
72
|
+
listServices: command$g,
|
|
73
|
+
startCommand: command$h,
|
|
74
|
+
disableTelemetry: command$i,
|
|
75
|
+
enableTelemetry: command$j,
|
|
76
|
+
generateTemplates: command$k,
|
|
77
|
+
generateTsTypes: command$l,
|
|
78
|
+
uninstallCommand: command$m,
|
|
79
|
+
versionCommand: command$n,
|
|
80
|
+
watchAdminCommand: command$o,
|
|
81
|
+
/**
|
|
82
|
+
* Plugins
|
|
83
|
+
*/
|
|
84
|
+
buildPluginCommand: command$p,
|
|
85
|
+
watchPluginCommand: command$q
|
|
85
86
|
};
|
|
86
|
-
const buildStrapiCommand = (argv, command2 = new commander.Command()) => {
|
|
87
|
+
const buildStrapiCommand = async (argv, command2 = new commander.Command()) => {
|
|
87
88
|
try {
|
|
88
89
|
const dtsCommands = require(require.resolve("@strapi/data-transfer")).commands;
|
|
89
90
|
Object.assign(strapiCommands, dtsCommands);
|
|
91
|
+
const adminCommands = require(require.resolve("@strapi/admin/cli")).commands;
|
|
92
|
+
Object.assign(strapiCommands, adminCommands);
|
|
90
93
|
} catch (e) {
|
|
91
94
|
}
|
|
92
95
|
command2.storeOptionsAsProperties(false).allowUnknownOption(true);
|
|
93
96
|
command2.helpOption("-h, --help", "Display help for command");
|
|
94
97
|
command2.addHelpCommand("help [command]", "Display help for command");
|
|
95
98
|
const keys = Object.keys(strapiCommands);
|
|
99
|
+
const cwd = process.cwd();
|
|
100
|
+
const hasDebug = argv.includes("--debug");
|
|
101
|
+
const hasSilent = argv.includes("--silent");
|
|
102
|
+
const logger$1 = logger.createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });
|
|
103
|
+
const tsconfig$1 = tsconfig.loadTsConfig({
|
|
104
|
+
cwd,
|
|
105
|
+
path: "tsconfig.json",
|
|
106
|
+
logger: logger$1
|
|
107
|
+
});
|
|
108
|
+
const ctx = {
|
|
109
|
+
cwd,
|
|
110
|
+
logger: logger$1,
|
|
111
|
+
tsconfig: tsconfig$1
|
|
112
|
+
};
|
|
96
113
|
keys.forEach((name) => {
|
|
97
114
|
try {
|
|
98
|
-
strapiCommands[name]({ command: command2, argv });
|
|
115
|
+
strapiCommands[name]({ command: command2, argv, ctx });
|
|
99
116
|
} catch (e) {
|
|
100
117
|
console.error(`Failed to load command ${name}`, e);
|
|
101
118
|
}
|
|
@@ -103,7 +120,8 @@ const buildStrapiCommand = (argv, command2 = new commander.Command()) => {
|
|
|
103
120
|
return command2;
|
|
104
121
|
};
|
|
105
122
|
const runStrapiCommand = async (argv = process.argv, command2 = new commander.Command()) => {
|
|
106
|
-
await buildStrapiCommand(argv, command2)
|
|
123
|
+
const commands = await buildStrapiCommand(argv, command2);
|
|
124
|
+
await commands.parseAsync(argv);
|
|
107
125
|
};
|
|
108
126
|
exports.buildStrapiCommand = buildStrapiCommand;
|
|
109
127
|
exports.runStrapiCommand = runStrapiCommand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/commands/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport createAdminUser from './actions/admin/create-user/command';\nimport resetAdminUserPassword from './actions/admin/reset-user-password/command';\nimport
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/commands/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport createAdminUser from './actions/admin/create-user/command';\nimport resetAdminUserPassword from './actions/admin/reset-user-password/command';\nimport listComponents from './actions/components/list/command';\nimport configurationDump from './actions/configuration/dump/command';\nimport configurationRestore from './actions/configuration/restore/command';\nimport consoleCommand from './actions/console/command';\nimport listContentTypes from './actions/content-types/list/command';\nimport listControllers from './actions/controllers/list/command';\nimport generateCommand from './actions/generate/command';\nimport listHooks from './actions/hooks/list/command';\nimport installCommand from './actions/install/command';\nimport listMiddlewares from './actions/middlewares/list/command';\nimport newCommand from './actions/new/command';\nimport listPolicies from './actions/policies/list/command';\nimport reportCommand from './actions/report/command';\nimport listRoutes from './actions/routes/list/command';\nimport listServices from './actions/services/list/command';\nimport startCommand from './actions/start/command';\nimport disableTelemetry from './actions/telemetry/disable/command';\nimport enableTelemetry from './actions/telemetry/enable/command';\nimport generateTemplates from './actions/templates/generate/command';\nimport generateTsTypes from './actions/ts/generate-types/command';\nimport uninstallCommand from './actions/uninstall/command';\nimport versionCommand from './actions/version/command';\nimport watchAdminCommand from './actions/watch-admin/command';\n\nimport buildPluginCommand from './actions/plugin/build-command/command';\nimport watchPluginCommand from './actions/plugin/watch/command';\n\nimport { createLogger } from './utils/logger';\nimport { loadTsConfig } from './utils/tsconfig';\nimport { CLIContext } from './types';\n\nconst strapiCommands = {\n createAdminUser,\n resetAdminUserPassword,\n listComponents,\n configurationDump,\n configurationRestore,\n consoleCommand,\n listContentTypes,\n listControllers,\n generateCommand,\n listHooks,\n installCommand,\n listMiddlewares,\n newCommand,\n listPolicies,\n reportCommand,\n listRoutes,\n listServices,\n startCommand,\n disableTelemetry,\n enableTelemetry,\n generateTemplates,\n generateTsTypes,\n uninstallCommand,\n versionCommand,\n watchAdminCommand,\n /**\n * Plugins\n */\n buildPluginCommand,\n watchPluginCommand,\n} as const;\n\nconst buildStrapiCommand = async (argv: string[], command = new Command()) => {\n try {\n // NOTE: this is a hack to allow loading dts commands without make dts a dependency of strapi and thus avoiding circular dependencies\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const dtsCommands = require(require.resolve('@strapi/data-transfer')).commands;\n Object.assign(strapiCommands, dtsCommands);\n // eslint-disable-next-line @typescript-eslint/no-var-requires, node/no-missing-require\n const adminCommands = require(require.resolve('@strapi/admin/cli')).commands;\n Object.assign(strapiCommands, adminCommands);\n } catch (e) {\n // noop\n }\n\n // Initial program setup\n command.storeOptionsAsProperties(false).allowUnknownOption(true);\n\n // Help command\n command.helpOption('-h, --help', 'Display help for command');\n command.addHelpCommand('help [command]', 'Display help for command');\n\n const keys = Object.keys(strapiCommands) as (keyof typeof strapiCommands)[];\n\n const cwd = process.cwd();\n\n const hasDebug = argv.includes('--debug');\n const hasSilent = argv.includes('--silent');\n\n const logger = createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });\n\n const tsconfig = loadTsConfig({\n cwd,\n path: 'tsconfig.json',\n logger,\n });\n\n const ctx = {\n cwd,\n logger,\n tsconfig,\n } satisfies CLIContext;\n\n // Load all commands\n keys.forEach((name) => {\n try {\n // Add this command to the Commander command object\n strapiCommands[name]({ command, argv, ctx });\n } catch (e) {\n console.error(`Failed to load command ${name}`, e);\n }\n });\n\n return command;\n};\n\nconst runStrapiCommand = async (argv = process.argv, command = new Command()) => {\n const commands = await buildStrapiCommand(argv, command);\n await commands.parseAsync(argv);\n};\n\nexport { runStrapiCommand, buildStrapiCommand, strapiCommands };\n"],"names":["createAdminUser","resetAdminUserPassword","listComponents","configurationDump","configurationRestore","consoleCommand","listContentTypes","listControllers","generateCommand","listHooks","installCommand","listMiddlewares","newCommand","listPolicies","reportCommand","listRoutes","listServices","startCommand","disableTelemetry","enableTelemetry","generateTemplates","generateTsTypes","uninstallCommand","versionCommand","watchAdminCommand","buildPluginCommand","watchPluginCommand","command","Command","logger","createLogger","tsconfig","loadTsConfig"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,iBAAiB;AAAA,EAAA,iBACrBA;AAAAA,EAAA,wBACAC;AAAAA,EAAA,gBACAC;AAAAA,EAAA,mBACAC;AAAAA,EAAA,sBACAC;AAAAA,EAAA,gBACAC;AAAAA,EAAA,kBACAC;AAAAA,EAAA,iBACAC;AAAAA,EAAA,iBACAC;AAAAA,EAAA,WACAC;AAAAA,EAAA,gBACAC;AAAAA,EAAA,iBACAC;AAAAA,EAAA,YACAC;AAAAA,EAAA,cACAC;AAAAA,EAAA,eACAC;AAAAA,EAAA,YACAC;AAAAA,EAAA,cACAC;AAAAA,EAAA,cACAC;AAAAA,EAAA,kBACAC;AAAAA,EAAA,iBACAC;AAAAA,EAAA,mBACAC;AAAAA,EAAA,iBACAC;AAAAA,EAAA,kBACAC;AAAAA,EAAA,gBACAC;AAAAA,EAAA,mBACAC;AAAAA;AAAAA;AAAAA;AAAAA,EAAA,oBAIAC;AAAAA,EAAA,oBACAC;AACF;AAEA,MAAM,qBAAqB,OAAO,MAAgBC,WAAU,IAAIC,wBAAc;AACxE,MAAA;AAGF,UAAM,cAAc,QAAQ,gBAAgB,uBAAuB,CAAC,EAAE;AAC/D,WAAA,OAAO,gBAAgB,WAAW;AAEzC,UAAM,gBAAgB,QAAQ,gBAAgB,mBAAmB,CAAC,EAAE;AAC7D,WAAA,OAAO,gBAAgB,aAAa;AAAA,WACpC,GAAG;AAAA,EAEZ;AAGA,EAAAD,SAAQ,yBAAyB,KAAK,EAAE,mBAAmB,IAAI;AAGvD,EAAAA,SAAA,WAAW,cAAc,0BAA0B;AACnD,EAAAA,SAAA,eAAe,kBAAkB,0BAA0B;AAE7D,QAAA,OAAO,OAAO,KAAK,cAAc;AAEjC,QAAA,MAAM,QAAQ;AAEd,QAAA,WAAW,KAAK,SAAS,SAAS;AAClC,QAAA,YAAY,KAAK,SAAS,UAAU;AAEpC,QAAAE,WAASC,oBAAa,EAAE,OAAO,UAAU,QAAQ,WAAW,WAAW,MAAA,CAAO;AAEpF,QAAMC,aAAWC,SAAAA,aAAa;AAAA,IAC5B;AAAA,IACA,MAAM;AAAA,IAAA,QACNH;AAAAA,EAAA,CACD;AAED,QAAM,MAAM;AAAA,IACV;AAAA,IAAA,QACAA;AAAAA,IAAA,UACAE;AAAAA,EAAA;AAIG,OAAA,QAAQ,CAAC,SAAS;AACjB,QAAA;AAEF,qBAAe,IAAI,EAAE,EAAE,SAAAJ,UAAS,MAAM,KAAK;AAAA,aACpC,GAAG;AACV,cAAQ,MAAM,0BAA0B,IAAI,IAAI,CAAC;AAAA,IACnD;AAAA,EAAA,CACD;AAEM,SAAAA;AACT;AAEM,MAAA,mBAAmB,OAAO,OAAO,QAAQ,MAAMA,WAAU,IAAIC,UAAAA,cAAc;AAC/E,QAAM,WAAW,MAAM,mBAAmB,MAAMD,QAAO;AACjD,QAAA,SAAS,WAAW,IAAI;AAChC;;;;"}
|
package/dist/commands/types.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
|
+
import { Logger } from './utils/logger';
|
|
3
|
+
import { TsConfig } from './utils/tsconfig';
|
|
4
|
+
export interface CLIContext {
|
|
5
|
+
cwd: string;
|
|
6
|
+
logger: Logger;
|
|
7
|
+
tsconfig?: TsConfig;
|
|
8
|
+
}
|
|
2
9
|
export type StrapiCommand = (params: {
|
|
3
10
|
command: Command;
|
|
4
11
|
argv: string[];
|
|
12
|
+
ctx: CLIContext;
|
|
5
13
|
}) => void;
|
|
6
14
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,UAAU,CAAA;CAAE,KAAK,IAAI,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import ora from 'ora';
|
|
1
2
|
export interface LoggerOptions {
|
|
2
3
|
silent?: boolean;
|
|
3
4
|
debug?: boolean;
|
|
@@ -11,6 +12,7 @@ export interface Logger {
|
|
|
11
12
|
warn: (...args: unknown[]) => void;
|
|
12
13
|
error: (...args: unknown[]) => void;
|
|
13
14
|
log: (...args: unknown[]) => void;
|
|
15
|
+
spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text'>;
|
|
14
16
|
}
|
|
15
17
|
declare const createLogger: (options?: LoggerOptions) => Logger;
|
|
16
18
|
export { createLogger };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/logger.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAClC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;CACjF;AAED,QAAA,MAAM,YAAY,aAAa,aAAa,KAAQ,MA0FnD,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const chalk = require("chalk");
|
|
4
|
+
const ora = require("ora");
|
|
4
5
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
5
6
|
const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
|
|
7
|
+
const ora__default = /* @__PURE__ */ _interopDefault(ora);
|
|
6
8
|
const createLogger = (options = {}) => {
|
|
7
9
|
const { silent = false, debug = false, timestamp = true } = options;
|
|
8
10
|
const state = { errors: 0, warning: 0 };
|
|
@@ -56,6 +58,24 @@ const createLogger = (options = {}) => {
|
|
|
56
58
|
chalk__default.default.red(`[ERROR]${timestamp ? ` [${(/* @__PURE__ */ new Date()).toISOString()}]` : ""}`),
|
|
57
59
|
...args
|
|
58
60
|
);
|
|
61
|
+
},
|
|
62
|
+
// @ts-expect-error – returning a subpart of ora is fine because the types tell us what is what.
|
|
63
|
+
spinner(text) {
|
|
64
|
+
if (silent) {
|
|
65
|
+
return {
|
|
66
|
+
succeed() {
|
|
67
|
+
return this;
|
|
68
|
+
},
|
|
69
|
+
fail() {
|
|
70
|
+
return this;
|
|
71
|
+
},
|
|
72
|
+
start() {
|
|
73
|
+
return this;
|
|
74
|
+
},
|
|
75
|
+
text: ""
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return ora__default.default(text);
|
|
59
79
|
}
|
|
60
80
|
};
|
|
61
81
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sources":["../../../src/commands/utils/logger.ts"],"sourcesContent":["import chalk from 'chalk';\n\nexport interface LoggerOptions {\n silent?: boolean;\n debug?: boolean;\n timestamp?: boolean;\n}\n\nexport interface Logger {\n warnings: number;\n errors: number;\n debug: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n log: (...args: unknown[]) => void;\n}\n\nconst createLogger = (options: LoggerOptions = {}): Logger => {\n const { silent = false, debug = false, timestamp = true } = options;\n\n const state = { errors: 0, warning: 0 };\n\n return {\n get warnings() {\n return state.warning;\n },\n\n get errors() {\n return state.errors;\n },\n\n debug(...args) {\n if (silent || !debug) {\n return;\n }\n\n console.log(\n chalk.cyan(`[DEBUG]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n info(...args) {\n if (silent) {\n return;\n }\n\n console.info(\n chalk.blue(`[INFO]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n log(...args) {\n if (silent) {\n return;\n }\n\n console.info(chalk.blue(`${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`), ...args);\n },\n\n warn(...args) {\n state.warning += 1;\n\n if (silent) {\n return;\n }\n\n console.warn(\n chalk.yellow(`[WARN]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n error(...args) {\n state.errors += 1;\n\n if (silent) {\n return;\n }\n\n console.error(\n chalk.red(`[ERROR]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n };\n};\n\nexport { createLogger };\n"],"names":["chalk"],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.js","sources":["../../../src/commands/utils/logger.ts"],"sourcesContent":["import chalk from 'chalk';\nimport ora from 'ora';\n\nexport interface LoggerOptions {\n silent?: boolean;\n debug?: boolean;\n timestamp?: boolean;\n}\n\nexport interface Logger {\n warnings: number;\n errors: number;\n debug: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n log: (...args: unknown[]) => void;\n spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text'>;\n}\n\nconst createLogger = (options: LoggerOptions = {}): Logger => {\n const { silent = false, debug = false, timestamp = true } = options;\n\n const state = { errors: 0, warning: 0 };\n\n return {\n get warnings() {\n return state.warning;\n },\n\n get errors() {\n return state.errors;\n },\n\n debug(...args) {\n if (silent || !debug) {\n return;\n }\n\n console.log(\n chalk.cyan(`[DEBUG]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n info(...args) {\n if (silent) {\n return;\n }\n\n console.info(\n chalk.blue(`[INFO]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n log(...args) {\n if (silent) {\n return;\n }\n\n console.info(chalk.blue(`${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`), ...args);\n },\n\n warn(...args) {\n state.warning += 1;\n\n if (silent) {\n return;\n }\n\n console.warn(\n chalk.yellow(`[WARN]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n error(...args) {\n state.errors += 1;\n\n if (silent) {\n return;\n }\n\n console.error(\n chalk.red(`[ERROR]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n // @ts-expect-error – returning a subpart of ora is fine because the types tell us what is what.\n spinner(text: string) {\n if (silent) {\n return {\n succeed() {\n return this;\n },\n fail() {\n return this;\n },\n start() {\n return this;\n },\n text: '',\n };\n }\n\n return ora(text);\n },\n };\n};\n\nexport { createLogger };\n"],"names":["chalk","ora"],"mappings":";;;;;;;AAoBA,MAAM,eAAe,CAAC,UAAyB,OAAe;AAC5D,QAAM,EAAE,SAAS,OAAO,QAAQ,OAAO,YAAY,KAAS,IAAA;AAE5D,QAAM,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAAE;AAE/B,SAAA;AAAA,IACL,IAAI,WAAW;AACb,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,IAAI,SAAS;AACX,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,SAAS,MAAM;AACT,UAAA,UAAU,CAAC,OAAO;AACpB;AAAA,MACF;AAEQ,cAAA;AAAA,QACNA,eAAAA,QAAM,KAAK,UAAU,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QACzE,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA,IAEA,QAAQ,MAAM;AACZ,UAAI,QAAQ;AACV;AAAA,MACF;AAEQ,cAAA;AAAA,QACNA,eAAAA,QAAM,KAAK,SAAS,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QACxE,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA,IAEA,OAAO,MAAM;AACX,UAAI,QAAQ;AACV;AAAA,MACF;AAEA,cAAQ,KAAKA,uBAAM,KAAK,GAAG,YAAY,MAAU,oBAAA,QAAO,YAAa,CAAA,MAAM,EAAE,EAAE,GAAG,GAAG,IAAI;AAAA,IAC3F;AAAA,IAEA,QAAQ,MAAM;AACZ,YAAM,WAAW;AAEjB,UAAI,QAAQ;AACV;AAAA,MACF;AAEQ,cAAA;AAAA,QACNA,eAAAA,QAAM,OAAO,SAAS,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QAC1E,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA,IAEA,SAAS,MAAM;AACb,YAAM,UAAU;AAEhB,UAAI,QAAQ;AACV;AAAA,MACF;AAEQ,cAAA;AAAA,QACNA,eAAAA,QAAM,IAAI,UAAU,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QACxE,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA;AAAA,IAGA,QAAQ,MAAc;AACpB,UAAI,QAAQ;AACH,eAAA;AAAA,UACL,UAAU;AACD,mBAAA;AAAA,UACT;AAAA,UACA,OAAO;AACE,mBAAA;AAAA,UACT;AAAA,UACA,QAAQ;AACC,mBAAA;AAAA,UACT;AAAA,UACA,MAAM;AAAA,QAAA;AAAA,MAEV;AAEA,aAAOC,aAAAA,QAAI,IAAI;AAAA,IACjB;AAAA,EAAA;AAEJ;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { Logger } from './logger';
|
|
3
|
+
interface TsConfig {
|
|
4
|
+
config: ts.ParsedCommandLine;
|
|
5
|
+
path: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @description Load a tsconfig.json file and return the parsed config.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
declare const loadTsConfig: ({ cwd, path, logger, }: {
|
|
13
|
+
cwd: string;
|
|
14
|
+
path: string;
|
|
15
|
+
logger: Logger;
|
|
16
|
+
}) => TsConfig | undefined;
|
|
17
|
+
export { loadTsConfig };
|
|
18
|
+
export type { TsConfig };
|
|
19
|
+
//# sourceMappingURL=tsconfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/tsconfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,UAAU,QAAQ;IAChB,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,QAAA,MAAM,YAAY;SAKX,MAAM;UACL,MAAM;YACJ,MAAM;MACZ,QAAQ,GAAG,SAiBd,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const os = require("os");
|
|
4
|
+
const ts = require("typescript");
|
|
5
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
6
|
+
const os__default = /* @__PURE__ */ _interopDefault(os);
|
|
7
|
+
const ts__default = /* @__PURE__ */ _interopDefault(ts);
|
|
8
|
+
const loadTsConfig = ({
|
|
9
|
+
cwd,
|
|
10
|
+
path,
|
|
11
|
+
logger
|
|
12
|
+
}) => {
|
|
13
|
+
const configPath = ts__default.default.findConfigFile(cwd, ts__default.default.sys.fileExists, path);
|
|
14
|
+
if (!configPath) {
|
|
15
|
+
return void 0;
|
|
16
|
+
}
|
|
17
|
+
const configFile = ts__default.default.readConfigFile(configPath, ts__default.default.sys.readFile);
|
|
18
|
+
const parsedConfig = ts__default.default.parseJsonConfigFileContent(configFile.config, ts__default.default.sys, cwd);
|
|
19
|
+
logger.debug(`Loaded user TS config:`, os__default.default.EOL, parsedConfig);
|
|
20
|
+
return {
|
|
21
|
+
config: parsedConfig,
|
|
22
|
+
path: configPath
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.loadTsConfig = loadTsConfig;
|
|
26
|
+
//# sourceMappingURL=tsconfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig.js","sources":["../../../src/commands/utils/tsconfig.ts"],"sourcesContent":["import os from 'os';\nimport ts from 'typescript';\nimport type { Logger } from './logger';\n\ninterface TsConfig {\n config: ts.ParsedCommandLine;\n path: string;\n}\n\n/**\n * @description Load a tsconfig.json file and return the parsed config.\n *\n * @internal\n */\nconst loadTsConfig = ({\n cwd,\n path,\n logger,\n}: {\n cwd: string;\n path: string;\n logger: Logger;\n}): TsConfig | undefined => {\n const configPath = ts.findConfigFile(cwd, ts.sys.fileExists, path);\n\n if (!configPath) {\n return undefined;\n }\n\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile);\n\n const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, cwd);\n\n logger.debug(`Loaded user TS config:`, os.EOL, parsedConfig);\n\n return {\n config: parsedConfig,\n path: configPath,\n };\n};\n\nexport { loadTsConfig };\nexport type { TsConfig };\n"],"names":["ts","os"],"mappings":";;;;;;;AAcA,MAAM,eAAe,CAAC;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AACF,MAI4B;AAC1B,QAAM,aAAaA,YAAG,QAAA,eAAe,KAAKA,YAAAA,QAAG,IAAI,YAAY,IAAI;AAEjE,MAAI,CAAC,YAAY;AACR,WAAA;AAAA,EACT;AAEA,QAAM,aAAaA,YAAAA,QAAG,eAAe,YAAYA,oBAAG,IAAI,QAAQ;AAEhE,QAAM,eAAeA,YAAG,QAAA,2BAA2B,WAAW,QAAQA,YAAA,QAAG,KAAK,GAAG;AAEjF,SAAO,MAAM,0BAA0BC,YAAAA,QAAG,KAAK,YAAY;AAEpD,SAAA;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,EAAA;AAEV;;"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,aAAa,MAAM,UAAU,CAAC;AAErC,mBAAmB,eAAe,CAAC;AAEnC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAEzC,eAAe,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,aAAa,MAAM,UAAU,CAAC;AAErC,mBAAmB,eAAe,CAAC;AAEnC,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAEzC,eAAe,aAAa,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable no-multi-assign */\n/* eslint-disable node/exports-style */\n/* eslint-disable import/no-import-module-exports */\nimport strapiFactory from './Strapi';\n\nexport type * from '@strapi/types';\n\nexport * as factories from './factories';\n\nexport default strapiFactory;\n\n// TODO: drop in v5 – see https://github.com/rollup/rollup/issues/1961 for more info on this decision\nmodule.exports = exports = strapiFactory;\n"],"names":["strapiFactory"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable no-multi-assign */\n/* eslint-disable node/exports-style */\n/* eslint-disable import/no-import-module-exports */\nimport strapiFactory from './Strapi';\n\nexport type * from '@strapi/types';\n\nexport type { StrapiCommand, CLIContext } from './commands/types';\n\nexport * as factories from './factories';\n\nexport default strapiFactory;\n\n// TODO: drop in v5 – see https://github.com/rollup/rollup/issues/1961 for more info on this decision\nmodule.exports = exports = strapiFactory;\n"],"names":["strapiFactory"],"mappings":";;;;AAcA,OAAO,UAAU,UAAUA;;;"}
|