@botpress/cli 0.4.3 → 0.4.5
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/api/client.js.map +2 -2
- package/dist/code-generation/index.js +12 -4
- package/dist/code-generation/index.js.map +2 -2
- package/dist/code-generation/integration-implementation.js +1 -38
- package/dist/code-generation/integration-implementation.js.map +2 -2
- package/dist/code-generation/integration-instance.js +2 -1
- package/dist/code-generation/integration-instance.js.map +2 -2
- package/dist/code-generation/map-integration.js +72 -0
- package/dist/code-generation/map-integration.js.map +7 -0
- package/dist/code-generation/typings.js.map +1 -1
- package/dist/command-implementations/add-command.js +27 -5
- package/dist/command-implementations/add-command.js.map +2 -2
- package/dist/command-implementations/base-command.js.map +1 -1
- package/dist/command-implementations/deploy-command.js +3 -2
- package/dist/command-implementations/deploy-command.js.map +2 -2
- package/dist/command-implementations/dev-command.js +3 -2
- package/dist/command-implementations/dev-command.js.map +2 -2
- package/dist/command-implementations/global-command.js +34 -21
- package/dist/command-implementations/global-command.js.map +3 -3
- package/dist/command-implementations/integration-commands.js +6 -0
- package/dist/command-implementations/integration-commands.js.map +2 -2
- package/dist/command-implementations/project-command.js +90 -6
- package/dist/command-implementations/project-command.js.map +3 -3
- package/dist/consts.js +0 -1
- package/dist/consts.js.map +2 -2
- package/dist/integration-ref.js +10 -0
- package/dist/integration-ref.js.map +2 -2
- package/dist/integration-ref.test.js +76 -0
- package/dist/integration-ref.test.js.map +7 -0
- package/dist/logger/base-logger.js.map +2 -2
- package/dist/root.js +2 -1
- package/dist/root.js.map +2 -2
- package/dist/utils/index.js +14 -8
- package/dist/utils/index.js.map +2 -2
- package/dist/utils/pkgjson-utils.js +53 -0
- package/dist/utils/pkgjson-utils.js.map +7 -0
- package/dist/utils/semver-utils.js +45 -0
- package/dist/utils/semver-utils.js.map +7 -0
- package/package.json +3 -3
- package/templates/echo-bot/package.json +2 -2
- package/templates/empty-integration/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/integration-ref.ts"],
|
|
4
|
-
"sourcesContent": ["import semver from 'semver'\nimport * as uuid from 'uuid'\n\nexport type UUIDIntegrationRef = {\n type: 'id'\n id: string\n}\n\nexport type NameIntegrationRef = {\n type: 'name'\n name: string\n version: string\n}\n\nexport type
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,WAAsB;
|
|
4
|
+
"sourcesContent": ["import semver from 'semver'\nimport * as uuid from 'uuid'\nimport * as utils from './utils'\n\nexport type UUIDIntegrationRef = {\n type: 'id'\n id: string\n}\n\nexport type NameIntegrationRef = {\n type: 'name'\n name: string\n version: string\n}\n\nexport type LocalPathIntegrationRef = {\n type: 'path'\n path: utils.path.AbsolutePath\n}\n\nexport type ApiIntegrationRef = UUIDIntegrationRef | NameIntegrationRef\nexport type IntegrationRef = ApiIntegrationRef | LocalPathIntegrationRef\n\nconst LATEST_TAG = 'latest'\n\nexport const formatIntegrationRef = (ref: IntegrationRef): string => {\n if (ref.type === 'path') {\n return ref.path\n }\n if (ref.type === 'id') {\n return ref.id\n }\n return `${ref.name}@${ref.version}`\n}\n\nexport const parseIntegrationRef = (ref: string): IntegrationRef | undefined => {\n if (!ref) {\n return\n }\n\n if (uuid.validate(ref)) {\n return { type: 'id', id: ref }\n }\n\n if (utils.path.isAbsolute(ref)) {\n return { type: 'path', path: ref }\n }\n\n if (!ref.includes('@')) {\n return { type: 'name', name: ref, version: LATEST_TAG }\n }\n\n const [name, version] = ref.split('@')\n if (!name || !version) {\n return\n }\n\n const cleanedVersion = version === LATEST_TAG ? version : semver.clean(version)\n if (!cleanedVersion) {\n return\n }\n\n return { type: 'name', name, version: cleanedVersion }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,WAAsB;AACtB,YAAuB;AAqBvB,MAAM,aAAa;AAEZ,MAAM,uBAAuB,CAAC,QAAgC;AACnE,MAAI,IAAI,SAAS,QAAQ;AACvB,WAAO,IAAI;AAAA,EACb;AACA,MAAI,IAAI,SAAS,MAAM;AACrB,WAAO,IAAI;AAAA,EACb;AACA,SAAO,GAAG,IAAI,QAAQ,IAAI;AAC5B;AAEO,MAAM,sBAAsB,CAAC,QAA4C;AAC9E,MAAI,CAAC,KAAK;AACR;AAAA,EACF;AAEA,MAAI,KAAK,SAAS,GAAG,GAAG;AACtB,WAAO,EAAE,MAAM,MAAM,IAAI,IAAI;AAAA,EAC/B;AAEA,MAAI,MAAM,KAAK,WAAW,GAAG,GAAG;AAC9B,WAAO,EAAE,MAAM,QAAQ,MAAM,IAAI;AAAA,EACnC;AAEA,MAAI,CAAC,IAAI,SAAS,GAAG,GAAG;AACtB,WAAO,EAAE,MAAM,QAAQ,MAAM,KAAK,SAAS,WAAW;AAAA,EACxD;AAEA,QAAM,CAAC,MAAM,OAAO,IAAI,IAAI,MAAM,GAAG;AACrC,MAAI,CAAC,QAAQ,CAAC,SAAS;AACrB;AAAA,EACF;AAEA,QAAM,iBAAiB,YAAY,aAAa,UAAU,cAAAA,QAAO,MAAM,OAAO;AAC9E,MAAI,CAAC,gBAAgB;AACnB;AAAA,EACF;AAEA,SAAO,EAAE,MAAM,QAAQ,MAAM,SAAS,eAAe;AACvD;",
|
|
6
6
|
"names": ["semver"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_node_test = require("node:test");
|
|
3
|
+
var import_vitest = require("vitest");
|
|
4
|
+
var import_integration_ref = require("./integration-ref");
|
|
5
|
+
const path = "/my/path";
|
|
6
|
+
const uuid = "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11";
|
|
7
|
+
const name = "myintegration";
|
|
8
|
+
(0, import_node_test.describe)("parseIntegrationRef", () => {
|
|
9
|
+
(0, import_vitest.test)("parse empty string should return undefined", () => {
|
|
10
|
+
const ref = "";
|
|
11
|
+
const result = (0, import_integration_ref.parseIntegrationRef)(ref);
|
|
12
|
+
(0, import_vitest.expect)(result).toBeUndefined();
|
|
13
|
+
});
|
|
14
|
+
(0, import_vitest.test)("parse with invalid version should return undefined", () => {
|
|
15
|
+
const ref0 = `${name}@lol`;
|
|
16
|
+
const ref1 = `${name}@1`;
|
|
17
|
+
const ref2 = `${name}@1.0`;
|
|
18
|
+
const result0 = (0, import_integration_ref.parseIntegrationRef)(ref0);
|
|
19
|
+
const result1 = (0, import_integration_ref.parseIntegrationRef)(ref1);
|
|
20
|
+
const result2 = (0, import_integration_ref.parseIntegrationRef)(ref2);
|
|
21
|
+
(0, import_vitest.expect)(result0).toBeUndefined();
|
|
22
|
+
(0, import_vitest.expect)(result1).toBeUndefined();
|
|
23
|
+
(0, import_vitest.expect)(result2).toBeUndefined();
|
|
24
|
+
});
|
|
25
|
+
(0, import_vitest.test)("parse with an absolute path should return path", () => {
|
|
26
|
+
const ref = path;
|
|
27
|
+
const result = (0, import_integration_ref.parseIntegrationRef)(ref);
|
|
28
|
+
const expected = { type: "path", path: ref };
|
|
29
|
+
(0, import_vitest.expect)(result).toEqual(expected);
|
|
30
|
+
});
|
|
31
|
+
(0, import_vitest.test)("parse with a uuid return uuid", () => {
|
|
32
|
+
const ref = uuid;
|
|
33
|
+
const result = (0, import_integration_ref.parseIntegrationRef)(ref);
|
|
34
|
+
const expected = { type: "id", id: ref };
|
|
35
|
+
(0, import_vitest.expect)(result).toEqual(expected);
|
|
36
|
+
});
|
|
37
|
+
(0, import_vitest.test)("parse with a name and version should return name and version", () => {
|
|
38
|
+
const version = "1.0.0";
|
|
39
|
+
const ref = `${name}@${version}`;
|
|
40
|
+
const result = (0, import_integration_ref.parseIntegrationRef)(ref);
|
|
41
|
+
const expected = { type: "name", name, version };
|
|
42
|
+
(0, import_vitest.expect)(result).toEqual(expected);
|
|
43
|
+
});
|
|
44
|
+
(0, import_vitest.test)("parse with a name and latest should return name and latest", () => {
|
|
45
|
+
const version = "latest";
|
|
46
|
+
const ref = `${name}@${version}`;
|
|
47
|
+
const result = (0, import_integration_ref.parseIntegrationRef)(ref);
|
|
48
|
+
const expected = { type: "name", name, version };
|
|
49
|
+
(0, import_vitest.expect)(result).toEqual(expected);
|
|
50
|
+
});
|
|
51
|
+
(0, import_vitest.test)("parse with only a name should return name and latest", () => {
|
|
52
|
+
const ref = name;
|
|
53
|
+
const result = (0, import_integration_ref.parseIntegrationRef)(ref);
|
|
54
|
+
const expected = { type: "name", name, version: "latest" };
|
|
55
|
+
(0, import_vitest.expect)(result).toEqual(expected);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
(0, import_node_test.describe)("formatIntegrationRef", () => {
|
|
59
|
+
(0, import_vitest.test)("format with a path should return path", () => {
|
|
60
|
+
const ref = { type: "path", path };
|
|
61
|
+
const result = (0, import_integration_ref.formatIntegrationRef)(ref);
|
|
62
|
+
(0, import_vitest.expect)(result).toEqual(ref.path);
|
|
63
|
+
});
|
|
64
|
+
(0, import_vitest.test)("format with a uuid should return uuid", () => {
|
|
65
|
+
const ref = { type: "id", id: uuid };
|
|
66
|
+
const result = (0, import_integration_ref.formatIntegrationRef)(ref);
|
|
67
|
+
(0, import_vitest.expect)(result).toEqual(ref.id);
|
|
68
|
+
});
|
|
69
|
+
(0, import_vitest.test)("format with a name and version should return name and version", () => {
|
|
70
|
+
const version = "1.0.0";
|
|
71
|
+
const ref = { type: "name", name, version };
|
|
72
|
+
const result = (0, import_integration_ref.formatIntegrationRef)(ref);
|
|
73
|
+
(0, import_vitest.expect)(result).toEqual(`${name}@${version}`);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=integration-ref.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/integration-ref.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { describe } from 'node:test'\nimport { test, expect } from 'vitest'\nimport { formatIntegrationRef, IntegrationRef, parseIntegrationRef } from './integration-ref'\n\nconst path = '/my/path'\nconst uuid = 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'\nconst name = 'myintegration'\n\ndescribe('parseIntegrationRef', () => {\n test('parse empty string should return undefined', () => {\n // arrange\n const ref = ''\n // act\n const result = parseIntegrationRef(ref)\n // assert\n expect(result).toBeUndefined()\n })\n\n test('parse with invalid version should return undefined', () => {\n // arrange\n const ref0 = `${name}@lol`\n const ref1 = `${name}@1`\n const ref2 = `${name}@1.0`\n // act\n const result0 = parseIntegrationRef(ref0)\n const result1 = parseIntegrationRef(ref1)\n const result2 = parseIntegrationRef(ref2)\n // assert\n expect(result0).toBeUndefined()\n expect(result1).toBeUndefined()\n expect(result2).toBeUndefined()\n })\n\n test('parse with an absolute path should return path', () => {\n // arrange\n const ref = path\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'path', path: ref }\n expect(result).toEqual(expected)\n })\n\n test('parse with a uuid return uuid', () => {\n // arrange\n const ref = uuid\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'id', id: ref }\n expect(result).toEqual(expected)\n })\n\n test('parse with a name and version should return name and version', () => {\n // arrange\n const version = '1.0.0'\n const ref = `${name}@${version}`\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'name', name, version }\n expect(result).toEqual(expected)\n })\n\n test('parse with a name and latest should return name and latest', () => {\n // arrange\n const version = 'latest'\n const ref = `${name}@${version}`\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'name', name, version }\n expect(result).toEqual(expected)\n })\n\n test('parse with only a name should return name and latest', () => {\n // arrange\n const ref = name\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'name', name, version: 'latest' }\n expect(result).toEqual(expected)\n })\n})\n\ndescribe('formatIntegrationRef', () => {\n test('format with a path should return path', () => {\n // arrange\n const ref: IntegrationRef = { type: 'path', path }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(ref.path)\n })\n\n test('format with a uuid should return uuid', () => {\n // arrange\n const ref: IntegrationRef = { type: 'id', id: uuid }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(ref.id)\n })\n\n test('format with a name and version should return name and version', () => {\n // arrange\n const version = '1.0.0'\n const ref: IntegrationRef = { type: 'name', name, version }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(`${name}@${version}`)\n })\n})\n"],
|
|
5
|
+
"mappings": ";AAAA,uBAAyB;AACzB,oBAA6B;AAC7B,6BAA0E;AAE1E,MAAM,OAAO;AACb,MAAM,OAAO;AACb,MAAM,OAAO;AAAA,IAEb,2BAAS,uBAAuB,MAAM;AACpC,0BAAK,8CAA8C,MAAM;AAEvD,UAAM,MAAM;AAEZ,UAAM,aAAS,4CAAoB,GAAG;AAEtC,8BAAO,MAAM,EAAE,cAAc;AAAA,EAC/B,CAAC;AAED,0BAAK,sDAAsD,MAAM;AAE/D,UAAM,OAAO,GAAG;AAChB,UAAM,OAAO,GAAG;AAChB,UAAM,OAAO,GAAG;AAEhB,UAAM,cAAU,4CAAoB,IAAI;AACxC,UAAM,cAAU,4CAAoB,IAAI;AACxC,UAAM,cAAU,4CAAoB,IAAI;AAExC,8BAAO,OAAO,EAAE,cAAc;AAC9B,8BAAO,OAAO,EAAE,cAAc;AAC9B,8BAAO,OAAO,EAAE,cAAc;AAAA,EAChC,CAAC;AAED,0BAAK,kDAAkD,MAAM;AAE3D,UAAM,MAAM;AAEZ,UAAM,aAAS,4CAAoB,GAAG;AAEtC,UAAM,WAA2B,EAAE,MAAM,QAAQ,MAAM,IAAI;AAC3D,8BAAO,MAAM,EAAE,QAAQ,QAAQ;AAAA,EACjC,CAAC;AAED,0BAAK,iCAAiC,MAA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AAU;AAChB,UAAM,MAAsB,EAAE,MAAM,QAAQ,MAAM,QAAQ;AAE1D,UAAM,aAAS,6CAAqB,GAAG;AAEvC,8BAAO,MAAM,EAAE,QAAQ,GAAG,QAAQ,SAAS;AAAA,EAC7C,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/logger/base-logger.ts"],
|
|
4
|
-
"sourcesContent": ["import boxen from 'boxen'\nimport chalk from 'chalk'\nimport _ from 'lodash'\nimport util from 'util'\n\nexport type LoggerOptions = {\n verbose: boolean\n json?: boolean // prevents loggin anything else than json\n}\n\nconst DEFAULT_OPTIONS: LoggerOptions = { verbose: false }\n\ntype ChalkColor = (str: string) => string\nconst NO_COLOR: ChalkColor = (str: string) => str\n\nconst PINK = [255, 100, 255] as const\nconst ORANGE = [255, 165, 0] as const\nconst PURPLE = [128, 0, 128] as const\n\nconst BG_COLORS: Record<Color, ChalkColor> = {\n blue: chalk.bgBlueBright,\n green: chalk.bgGreenBright,\n yellow: chalk.bgYellowBright,\n red: chalk.bgRedBright,\n white: chalk.bgWhite,\n pink: (str: string) => chalk.bgRgb(...PINK)(str),\n orange: (str: string) => chalk.bgRgb(...ORANGE)(str),\n purple: (str: string) => chalk.bgRgb(...PURPLE)(str),\n}\n\nconst FG_COLORS: Record<Color, ChalkColor> = {\n blue: chalk.blueBright,\n green: chalk.green,\n yellow: chalk.yellowBright,\n red: chalk.red,\n white: chalk.white,\n pink: (str: string) => chalk.rgb(...PINK)(str),\n orange: (str: string) => chalk.rgb(...ORANGE)(str),\n purple: (str: string) => chalk.rgb(...PURPLE)(str),\n}\n\ntype Symbol = '\u2713' | '\u26A0' | '\u00D7' | '\u25CF' | ' ' | '\u25CB'\ntype Color = 'blue' | 'green' | 'yellow' | 'red' | 'pink' | 'white' | 'orange' | 'purple'\ntype LogPrefix = { symbol: Symbol;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xen'\nimport chalk from 'chalk'\nimport _ from 'lodash'\nimport util from 'util'\n\nexport type LoggerOptions = {\n verbose: boolean\n json?: boolean // prevents loggin anything else than json\n}\n\nconst DEFAULT_OPTIONS: LoggerOptions = { verbose: false }\n\ntype ChalkColor = (str: string) => string\nconst NO_COLOR: ChalkColor = (str: string) => str\n\nconst PINK = [255, 100, 255] as const\nconst ORANGE = [255, 165, 0] as const\nconst PURPLE = [128, 0, 128] as const\n\nconst BG_COLORS: Record<Color, ChalkColor> = {\n blue: chalk.bgBlueBright,\n green: chalk.bgGreenBright,\n yellow: chalk.bgYellowBright,\n red: chalk.bgRedBright,\n white: chalk.bgWhite,\n pink: (str: string) => chalk.bgRgb(...PINK)(str),\n orange: (str: string) => chalk.bgRgb(...ORANGE)(str),\n purple: (str: string) => chalk.bgRgb(...PURPLE)(str),\n}\n\nconst FG_COLORS: Record<Color, ChalkColor> = {\n blue: chalk.blueBright,\n green: chalk.green,\n yellow: chalk.yellowBright,\n red: chalk.red,\n white: chalk.white,\n pink: (str: string) => chalk.rgb(...PINK)(str),\n orange: (str: string) => chalk.rgb(...ORANGE)(str),\n purple: (str: string) => chalk.rgb(...PURPLE)(str),\n}\n\ntype Symbol = '\u2713' | '\u26A0' | '\u00D7' | '\u25CF' | ' ' | '\u25CB'\ntype Color = 'blue' | 'green' | 'yellow' | 'red' | 'pink' | 'white' | 'orange' | 'purple'\ntype LogPrefix = { symbol: Symbol; fg?: Color; bg?: Color; indent?: number } | string\ntype SymbolRenderer<T extends Symbol> = { default: T; windows?: string; mac?: string }\n\ntype LogProps = {\n metadata: any\n prefix: LogPrefix\n stderr?: boolean\n}\n\ntype PrintProps = {\n metadata: any\n prefix: string\n stderr?: boolean\n}\n\nconst checkmark: SymbolRenderer<'\u2713'> = {\n default: '\u2713',\n windows: '\u221A',\n mac: '\u2714',\n}\n\nconst cross: SymbolRenderer<'\u00D7'> = {\n default: '\u00D7',\n mac: '\u2716',\n}\n\nconst danger: SymbolRenderer<'\u26A0'> = { default: '\u26A0' }\nconst circle: SymbolRenderer<'\u25CB'> = { default: '\u25CB' }\nconst disc: SymbolRenderer<'\u25CF'> = { default: '\u25CF' }\nconst space: SymbolRenderer<' '> = { default: ' ' }\n\nconst renderers: Record<Symbol, SymbolRenderer<Symbol>> = {\n '\u2713': checkmark,\n '\u00D7': cross,\n '\u26A0': danger,\n '\u25CB': circle,\n '\u25CF': disc,\n ' ': space,\n}\n\nconst BOX_OPTIONS: boxen.Options = {\n padding: 1,\n margin: 1,\n borderStyle: 'round',\n borderColor: 'yellow',\n}\n\nexport abstract class BaseLogger {\n protected opts: LoggerOptions\n\n constructor(opts: Partial<LoggerOptions> = {}) {\n this.opts = { ...DEFAULT_OPTIONS, ...opts }\n }\n\n public log(message: string, props: Partial<LogProps> = {}): void {\n if (this.opts.json && !props.stderr) {\n return\n }\n\n const prefix = this._resolvePrefix(props.prefix)\n this.print(message, { ...props, prefix })\n }\n\n public json(data: any, opts: Partial<{ depth: number }> = { depth: Infinity }): void {\n if (this.opts.json) {\n this.print(JSON.stringify(data, undefined, 2))\n return\n }\n\n const { depth } = opts\n const msg = util.inspect(data, { colors: true, depth })\n this.log(msg)\n }\n\n public debug(message: string, metadata?: any): void {\n if (!this.opts.verbose) {\n return\n }\n this.log(chalk.grey(message), { metadata, prefix: { symbol: '\u25CF', fg: 'blue' } })\n }\n\n public started(message: string, metadata?: any): void {\n this.log(message, { metadata, prefix: { symbol: '\u25CB', fg: 'purple' } })\n }\n\n public success(message: string, metadata?: any): void {\n this.log(message, { metadata, prefix: { symbol: '\u2713', fg: 'green' } })\n }\n\n public warn(message: string, metadata?: any): void {\n this.log(message, { metadata, prefix: { symbol: '\u26A0', fg: 'yellow' } })\n }\n\n public error(message: string, metadata?: any): void {\n this.log(message, { metadata, prefix: { symbol: '\u00D7', fg: 'red' }, stderr: true })\n }\n\n public box(message: string): void {\n const box = boxen(message, BOX_OPTIONS)\n this.log(box)\n }\n\n protected abstract print(message: string, props?: Partial<PrintProps>): void\n\n private _resolvePrefix(prefix: LogPrefix | undefined): string | undefined {\n if (!prefix) {\n return\n }\n\n if (_.isString(prefix)) {\n return prefix\n }\n\n const { symbol, fg, bg, indent } = prefix\n const renderedSymbol = this._renderSymbol(symbol)\n const fgcolor = fg ? FG_COLORS[fg] : NO_COLOR\n const bgcolor = bg ? BG_COLORS[bg] : NO_COLOR\n const indentStr = indent ? ' '.repeat(indent) : ''\n const symbolStr = fgcolor(bgcolor(renderedSymbol))\n return `${indentStr}${symbolStr}`\n }\n\n private _renderSymbol(symbol: Symbol): string {\n const renderer = renderers[symbol]\n if (process.platform === 'win32') {\n return renderer.windows || renderer.default\n } else if (process.platform === 'darwin') {\n return renderer.mac || renderer.default\n } else {\n return renderer.default\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,mBAAkB;AAClB,oBAAc;AACd,kBAAiB;AAOjB,MAAM,kBAAiC,EAAE,SAAS,MAAM;AAGxD,MAAM,WAAuB,CAAC,QAAgB;AAE9C,MAAM,OAAO,CAAC,KAAK,KAAK,GAAG;AAC3B,MAAM,SAAS,CAAC,KAAK,KAAK,CAAC;AAC3B,MAAM,SAAS,CAAC,KAAK,GAAG,GAAG;AAE3B,MAAM,YAAuC;AAAA,EAC3C,MAAM,aAAAA,QAAM;AAAA,EACZ,OAAO,aAAAA,QAAM;AAAA,EACb,QAAQ,aAAAA,QAAM;AAAA,EACd,KAAK,aAAAA,QAAM;AAAA,EACX,OAAO,aAAAA,QAAM;AAAA,EACb,MAAM,CAAC,QAAgB,aAAAA,QAAM,MAAM,GAAG,IAAI,EAAE,GAAG;AAAA,EAC/C,QAAQ,CAAC,QAAgB,aAAAA,QAAM,MAAM,GAAG,MAAM,EAAE,GAAG;AAAA,EACnD,QAAQ,CAAC,QAAgB,aAAAA,QAAM,MAAM,GAAG,MAAM,EAAE,GAAG;AACrD;AAEA,MAAM,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AAAA,IACF;AAEA,QAAI,cAAAC,QAAE,SAAS,MAAM,GAAG;AACtB,aAAO;AAAA,IACT;AAEA,UAAM,EAAE,QAAQ,IAAI,IAAI,OAAO,IAAI;AACnC,UAAM,iBAAiB,KAAK,cAAc,MAAM;AAChD,UAAM,UAAU,KAAK,UAAU,MAAM;AACrC,UAAM,UAAU,KAAK,UAAU,MAAM;AACrC,UAAM,YAAY,SAAS,IAAI,OAAO,MAAM,IAAI;AAChD,UAAM,YAAY,QAAQ,QAAQ,cAAc,CAAC;AACjD,WAAO,GAAG,YAAY;AAAA,EACxB;AAAA,EAEQ,cAAc,QAAwB;AAC5C,UAAM,WAAW,UAAU;AAC3B,QAAI,QAAQ,aAAa,SAAS;AAChC,aAAO,SAAS,WAAW,SAAS;AAAA,IACtC,WAAW,QAAQ,aAAa,UAAU;AACxC,aAAO,SAAS,OAAO,SAAS;AAAA,IAClC,OAAO;AACL,aAAO,SAAS;AAAA,IAClB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["chalk", "util", "boxen", "_"]
|
|
7
7
|
}
|
package/dist/root.js
CHANGED
|
@@ -28,7 +28,8 @@ __export(root_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(root_exports);
|
|
30
30
|
var utils = __toESM(require("./utils"));
|
|
31
|
-
const
|
|
31
|
+
const SRC_DIR = __dirname;
|
|
32
|
+
const CLI_ROOT_DIR = utils.path.join(SRC_DIR, "..");
|
|
32
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
34
|
0 && (module.exports = {
|
|
34
35
|
CLI_ROOT_DIR
|
package/dist/root.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/root.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Important:\n *\n * This file must be kept at the root of the src directory (and dist directory when built)\n */\nimport * as utils from './utils'\n\nexport const CLI_ROOT_DIR = utils.path.join(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * Important:\n *\n * This file must be kept at the root of the src directory (and dist directory when built)\n */\nimport * as utils from './utils'\n\nconst SRC_DIR = __dirname as utils.path.AbsolutePath\nexport const CLI_ROOT_DIR = utils.path.join(SRC_DIR, '..')\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,YAAuB;AAEvB,MAAM,UAAU;AACT,MAAM,eAAe,MAAM,KAAK,KAAK,SAAS,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/utils/index.js
CHANGED
|
@@ -31,29 +31,33 @@ __export(utils_exports, {
|
|
|
31
31
|
filewatcher: () => filewatcher,
|
|
32
32
|
guards: () => guards,
|
|
33
33
|
path: () => path,
|
|
34
|
+
pkgJson: () => pkgJson,
|
|
34
35
|
prompt: () => prompt,
|
|
35
36
|
records: () => records,
|
|
36
37
|
require: () => require2,
|
|
37
38
|
schema: () => schema,
|
|
39
|
+
semver: () => semver,
|
|
38
40
|
tunnel: () => tunnel,
|
|
39
41
|
types: () => types,
|
|
40
42
|
url: () => url
|
|
41
43
|
});
|
|
42
44
|
module.exports = __toCommonJS(utils_exports);
|
|
43
|
-
var esbuild = __toESM(require("./esbuild-utils"));
|
|
44
|
-
var path = __toESM(require("./path-utils"));
|
|
45
|
-
var require2 = __toESM(require("./require-utils"));
|
|
46
|
-
var filewatcher = __toESM(require("./file-watcher"));
|
|
47
|
-
var emitter = __toESM(require("./event-emitter"));
|
|
48
45
|
var cache = __toESM(require("./cache-utils"));
|
|
49
46
|
var casing = __toESM(require("./case-utils"));
|
|
47
|
+
var emitter = __toESM(require("./event-emitter"));
|
|
48
|
+
var esbuild = __toESM(require("./esbuild-utils"));
|
|
49
|
+
var filewatcher = __toESM(require("./file-watcher"));
|
|
50
|
+
var guards = __toESM(require("./guard-utils"));
|
|
51
|
+
var path = __toESM(require("./path-utils"));
|
|
52
|
+
var pkgJson = __toESM(require("./pkgjson-utils"));
|
|
50
53
|
var prompt = __toESM(require("./prompt-utils"));
|
|
51
54
|
var records = __toESM(require("./record-utils"));
|
|
52
|
-
var
|
|
53
|
-
var tunnel = __toESM(require("./tunnel-utils"));
|
|
55
|
+
var require2 = __toESM(require("./require-utils"));
|
|
54
56
|
var schema = __toESM(require("./schema-utils"));
|
|
57
|
+
var semver = __toESM(require("./semver-utils"));
|
|
58
|
+
var tunnel = __toESM(require("./tunnel-utils"));
|
|
55
59
|
var types = __toESM(require("./type-utils"));
|
|
56
|
-
var
|
|
60
|
+
var url = __toESM(require("./url-utils"));
|
|
57
61
|
// Annotate the CommonJS export names for ESM import in node:
|
|
58
62
|
0 && (module.exports = {
|
|
59
63
|
cache,
|
|
@@ -63,10 +67,12 @@ var guards = __toESM(require("./guard-utils"));
|
|
|
63
67
|
filewatcher,
|
|
64
68
|
guards,
|
|
65
69
|
path,
|
|
70
|
+
pkgJson,
|
|
66
71
|
prompt,
|
|
67
72
|
records,
|
|
68
73
|
require,
|
|
69
74
|
schema,
|
|
75
|
+
semver,
|
|
70
76
|
tunnel,
|
|
71
77
|
types,
|
|
72
78
|
url
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * as
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["export * as cache from './cache-utils'\nexport * as casing from './case-utils'\nexport * as emitter from './event-emitter'\nexport * as esbuild from './esbuild-utils'\nexport * as filewatcher from './file-watcher'\nexport * as guards from './guard-utils'\nexport * as path from './path-utils'\nexport * as pkgJson from './pkgjson-utils'\nexport * as prompt from './prompt-utils'\nexport * as records from './record-utils'\nexport * as require from './require-utils'\nexport * as schema from './schema-utils'\nexport * as semver from './semver-utils'\nexport * as tunnel from './tunnel-utils'\nexport * as types from './type-utils'\nexport * as url from './url-utils'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,aAAwB;AACxB,cAAyB;AACzB,cAAyB;AACzB,kBAA6B;AAC7B,aAAwB;AACxB,WAAsB;AACtB,cAAyB;AACzB,aAAwB;AACxB,cAAyB;AACzB,IAAAA,WAAyB;AACzB,aAAwB;AACxB,aAAwB;AACxB,aAAwB;AACxB,YAAuB;AACvB,UAAqB;",
|
|
6
6
|
"names": ["require"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var pkgjson_utils_exports = {};
|
|
26
|
+
__export(pkgjson_utils_exports, {
|
|
27
|
+
findDependency: () => findDependency,
|
|
28
|
+
readPackageJson: () => readPackageJson
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(pkgjson_utils_exports);
|
|
31
|
+
var import_fs = __toESM(require("fs"));
|
|
32
|
+
var import_path = __toESM(require("path"));
|
|
33
|
+
const FILE_NAME = "package.json";
|
|
34
|
+
const readPackageJson = async (path) => {
|
|
35
|
+
const filePath = import_path.default.basename(path) === FILE_NAME ? path : import_path.default.join(path, FILE_NAME);
|
|
36
|
+
if (!import_fs.default.existsSync(filePath)) {
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
const strContent = await import_fs.default.promises.readFile(filePath, "utf8");
|
|
40
|
+
const jsonContent = JSON.parse(strContent);
|
|
41
|
+
return jsonContent;
|
|
42
|
+
};
|
|
43
|
+
const findDependency = (pkgJson, name) => {
|
|
44
|
+
const { dependencies, devDependencies, peerDependencies } = pkgJson;
|
|
45
|
+
const allDependencies = { ...dependencies ?? {}, ...devDependencies ?? {}, ...peerDependencies ?? {} };
|
|
46
|
+
return allDependencies[name];
|
|
47
|
+
};
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
findDependency,
|
|
51
|
+
readPackageJson
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=pkgjson-utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/pkgjson-utils.ts"],
|
|
4
|
+
"sourcesContent": ["import fs from 'fs'\nimport pathlib from 'path'\n\nexport type PackageJson = {\n name: string\n version?: string\n description?: string\n scripts?: Record<string, string>\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n peerDependencies?: Record<string, string>\n}\n\nconst FILE_NAME = 'package.json'\n\nexport const readPackageJson = async (path: string): Promise<PackageJson | undefined> => {\n const filePath = pathlib.basename(path) === FILE_NAME ? path : pathlib.join(path, FILE_NAME)\n if (!fs.existsSync(filePath)) {\n return undefined\n }\n\n const strContent: string = await fs.promises.readFile(filePath, 'utf8')\n const jsonContent = JSON.parse(strContent)\n return jsonContent\n}\n\nexport const findDependency = (pkgJson: PackageJson, name: string): string | undefined => {\n const { dependencies, devDependencies, peerDependencies } = pkgJson\n const allDependencies = { ...(dependencies ?? {}), ...(devDependencies ?? {}), ...(peerDependencies ?? {}) }\n return allDependencies[name]\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAe;AACf,kBAAoB;AAYpB,MAAM,YAAY;AAEX,MAAM,kBAAkB,OAAO,SAAmD;AACvF,QAAM,WAAW,YAAAA,QAAQ,SAAS,IAAI,MAAM,YAAY,OAAO,YAAAA,QAAQ,KAAK,MAAM,SAAS;AAC3F,MAAI,CAAC,UAAAC,QAAG,WAAW,QAAQ,GAAG;AAC5B,WAAO;AAAA,EACT;AAEA,QAAM,aAAqB,MAAM,UAAAA,QAAG,SAAS,SAAS,UAAU,MAAM;AACtE,QAAM,cAAc,KAAK,MAAM,UAAU;AACzC,SAAO;AACT;AAEO,MAAM,iBAAiB,CAAC,SAAsB,SAAqC;AACxF,QAAM,EAAE,cAAc,iBAAiB,iBAAiB,IAAI;AAC5D,QAAM,kBAAkB,EAAE,GAAI,gBAAgB,CAAC,GAAI,GAAI,mBAAmB,CAAC,GAAI,GAAI,oBAAoB,CAAC,EAAG;AAC3G,SAAO,gBAAgB;AACzB;",
|
|
6
|
+
"names": ["pathlib", "fs"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var semver_utils_exports = {};
|
|
20
|
+
__export(semver_utils_exports, {
|
|
21
|
+
releases: () => releases
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(semver_utils_exports);
|
|
24
|
+
const semverReleases = {
|
|
25
|
+
prerelease: 0,
|
|
26
|
+
prepatch: 1,
|
|
27
|
+
patch: 2,
|
|
28
|
+
preminor: 3,
|
|
29
|
+
minor: 4,
|
|
30
|
+
premajor: 5,
|
|
31
|
+
major: 6
|
|
32
|
+
};
|
|
33
|
+
var releases;
|
|
34
|
+
((releases2) => {
|
|
35
|
+
releases2.eq = (a, b) => semverReleases[a] === semverReleases[b];
|
|
36
|
+
releases2.gt = (a, b) => semverReleases[a] > semverReleases[b];
|
|
37
|
+
releases2.gte = (a, b) => semverReleases[a] >= semverReleases[b];
|
|
38
|
+
releases2.lt = (a, b) => semverReleases[a] < semverReleases[b];
|
|
39
|
+
releases2.lte = (a, b) => semverReleases[a] <= semverReleases[b];
|
|
40
|
+
})(releases || (releases = {}));
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
releases
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=semver-utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/semver-utils.ts"],
|
|
4
|
+
"sourcesContent": ["import semver from 'semver'\n\nconst semverReleases: Record<semver.ReleaseType, number> = {\n prerelease: 0,\n prepatch: 1,\n patch: 2,\n preminor: 3,\n minor: 4,\n premajor: 5,\n major: 6,\n}\n\nexport namespace releases {\n export const eq = (a: semver.ReleaseType, b: semver.ReleaseType) => semverReleases[a] === semverReleases[b]\n export const gt = (a: semver.ReleaseType, b: semver.ReleaseType) => semverReleases[a] > semverReleases[b]\n export const gte = (a: semver.ReleaseType, b: semver.ReleaseType) => semverReleases[a] >= semverReleases[b]\n export const lt = (a: semver.ReleaseType, b: semver.ReleaseType) => semverReleases[a] < semverReleases[b]\n export const lte = (a: semver.ReleaseType, b: semver.ReleaseType) => semverReleases[a] <= semverReleases[b]\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,iBAAqD;AAAA,EACzD,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AACT;AAEO,IAAU;AAAA,CAAV,CAAUA,cAAV;AACE,EAAMA,UAAA,KAAK,CAAC,GAAuB,MAA0B,eAAe,OAAO,eAAe;AAClG,EAAMA,UAAA,KAAK,CAAC,GAAuB,MAA0B,eAAe,KAAK,eAAe;AAChG,EAAMA,UAAA,MAAM,CAAC,GAAuB,MAA0B,eAAe,MAAM,eAAe;AAClG,EAAMA,UAAA,KAAK,CAAC,GAAuB,MAA0B,eAAe,KAAK,eAAe;AAChG,EAAMA,UAAA,MAAM,CAAC,GAAuB,MAA0B,eAAe,MAAM,eAAe;AAAA,GAL1F;",
|
|
6
|
+
"names": ["releases"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Botpress CLI",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "pnpm run bundle && pnpm run template:gen",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"main": "dist/index.js",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@botpress/client": "0.
|
|
23
|
+
"@botpress/client": "0.4.0",
|
|
24
24
|
"@bpinternal/tunnel": "^0.1.0",
|
|
25
25
|
"@bpinternal/yargs-extra": "^0.0.3",
|
|
26
26
|
"@bpinternal/zod-to-json-schema": "^3.21.4",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"zod": "^3.20.6"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@botpress/sdk": "0.4.
|
|
50
|
+
"@botpress/sdk": "0.4.5",
|
|
51
51
|
"@bpinternal/log4bot": "^0.0.4",
|
|
52
52
|
"@types/bluebird": "^3.5.38",
|
|
53
53
|
"@types/json-schema": "^7.0.11",
|