dotcom-tool-kit 4.3.4 → 4.3.6
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/lib/messages.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,cAAc,EACf,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AASzD,eAAO,MAAM,mBAAmB,cAAe,CAAC,MAAM,EAAE,SAAS,UAAU,CAAC,CAAC,EAAE,KAAG,MAKT,CAAA;AAOzE,eAAO,MAAM,mBAAmB,cAAe,CAAC,MAAM,EAAE,SAAS,UAAU,CAAC,CAAC,EAAE,KAAG,MAKT,CAAA;AAezE,eAAO,MAAM,0BAA0B,cAAe,SAAS,WAAW,CAAC,EAAE,KAAG,MAQ/E,CAAA;AAOD,eAAO,MAAM,2BAA2B,cAAe,SAAS,gBAAgB,CAAC,EAAE,KAAG,MAUrF,CAAA;AAOD,eAAO,MAAM,yBAAyB,cAAe,SAAS,cAAc,CAAC,EAAE,KAAG,MAUjF,CAAA;AAKD,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;AAEhD,eAAO,MAAM,mBAAmB,kCAAiC,
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN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EAAE,SAChB,MAAM,EAAE,KACd,MAOF,CAAA;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAezD;AAED,eAAO,MAAM,aAAa,YAAa,MAAM,KAAG,MAAwC,CAAA;AAMxF,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,UAiCvC"}
|
package/lib/messages.js
CHANGED
|
@@ -54,7 +54,11 @@ You must resolve this conflict by providing options in your app's Tool Kit confi
|
|
|
54
54
|
`;
|
|
55
55
|
exports.formatTaskOptionConflicts = formatTaskOptionConflicts;
|
|
56
56
|
const formatPlugin = (plugin) => plugin.id === 'app root' ? logger_1.styles.app('your app') : `plugin ${logger_1.styles.plugin(plugin.id)}`;
|
|
57
|
-
const formatInvalidOption = ([id, error]) => (0, zod_validation_error_1.fromZodError)(error, {
|
|
57
|
+
const formatInvalidOption = ([id, error]) => (0, zod_validation_error_1.fromZodError)(error, {
|
|
58
|
+
prefix: `${logger_1.styles.warning((0, pluralize_1.default)('issue', error.issues.length, true))} in ${logger_1.styles.plugin(id)}`,
|
|
59
|
+
prefixSeparator: ':\n- ',
|
|
60
|
+
issueSeparator: '\n- '
|
|
61
|
+
}).message;
|
|
58
62
|
exports.formatInvalidOption = formatInvalidOption;
|
|
59
63
|
const formatInvalidPluginOptions = (invalidOptions) => `Please update the options so that they are the expected types.
|
|
60
64
|
${invalidOptions.map(([plugin, error]) => (0, exports.formatInvalidOption)([logger_1.styles.plugin(plugin), error])).join('\n')}
|
|
@@ -132,6 +136,8 @@ function formatPluginTree(plugin) {
|
|
|
132
136
|
exports.formatPluginTree = formatPluginTree;
|
|
133
137
|
const indentReasons = (reasons) => reasons.replace(/\n/g, '\n ');
|
|
134
138
|
exports.indentReasons = indentReasons;
|
|
139
|
+
// instanceof is unreliable across packages because of version mismatches so also use a heuristic to guess if it's a ToolKitError so we always log the details field if present
|
|
140
|
+
const guessIfToolKitError = (error) => error instanceof error_1.ToolKitError || 'details' in error;
|
|
135
141
|
function formatError(error) {
|
|
136
142
|
let output = `${logger_1.styles.error(error.name)}: ${error.message}\n`;
|
|
137
143
|
if (error instanceof AggregateError) {
|
|
@@ -140,11 +146,19 @@ function formatError(error) {
|
|
|
140
146
|
.map((message, messageIndex) => {
|
|
141
147
|
const lines = message.split('\n');
|
|
142
148
|
// TODO:KB:20241125 refactor the tree formatter from this and formatPluginTree into a shared function
|
|
143
|
-
return lines
|
|
149
|
+
return lines
|
|
150
|
+
.map((line, lineIndex) => (messageIndex === error.errors.length - 1
|
|
151
|
+
? lineIndex === 0
|
|
152
|
+
? '╰─'
|
|
153
|
+
: ' '
|
|
154
|
+
: lineIndex === 0
|
|
155
|
+
? '├─'
|
|
156
|
+
: '│ ') + line)
|
|
157
|
+
.join('\n');
|
|
144
158
|
})
|
|
145
159
|
.join('\n');
|
|
146
160
|
}
|
|
147
|
-
else if (error
|
|
161
|
+
else if (guessIfToolKitError(error)) {
|
|
148
162
|
if (error.details) {
|
|
149
163
|
output += logger_1.styles.info(error.details);
|
|
150
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-point.d.ts","sourceRoot":"","sources":["../../src/plugin/entry-point.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAW,MAAM,4BAA4B,CAAA;AAS/D,wBAAsB,gBAAgB,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC,EAC1F,IAAI,EAAE,CAAC,EACP,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"entry-point.d.ts","sourceRoot":"","sources":["../../src/plugin/entry-point.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAW,MAAM,4BAA4B,CAAA;AAS/D,wBAAsB,gBAAgB,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC,EAC1F,IAAI,EAAE,CAAC,EACP,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAwCvB"}
|
|
@@ -26,15 +26,13 @@ async function importEntryPoint(type, entryPoint) {
|
|
|
26
26
|
`an error was thrown when loading entrypoint ${logger_1.styles.filepath(entryPoint.modulePath)} in plugin ${logger_1.styles.plugin(entryPoint.plugin.id)}:\n ${logger_1.styles.code((0, messages_1.indentReasons)(err.toString()))}`
|
|
27
27
|
]);
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
]);
|
|
37
|
-
}
|
|
29
|
+
const defaultExport = (0, tslib_1.__importDefault)(pluginModule).default;
|
|
30
|
+
if (typeof defaultExport === 'function') {
|
|
31
|
+
return type
|
|
32
|
+
.isCompatible(defaultExport)
|
|
33
|
+
.mapError((reasons) => [
|
|
34
|
+
`the ${type.name.toLowerCase()} ${logger_1.styles.hook(defaultExport.name)} is not a compatible instance of ${logger_1.styles.code(type.name)}:\n - ${reasons.join('\n - ')}`
|
|
35
|
+
]);
|
|
38
36
|
}
|
|
39
37
|
return (0, validated_1.invalid)([
|
|
40
38
|
`entrypoint ${logger_1.styles.filepath(entryPoint.modulePath)} in plugin ${logger_1.styles.plugin(entryPoint.plugin.id)} does not export a class as its ${logger_1.styles.code('default')} export or ${logger_1.styles.code('module.exports')}`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotcom-tool-kit",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.6",
|
|
4
4
|
"description": "modern, maintainable, modular developer tooling for FT.com projects",
|
|
5
5
|
"author": "FT.com Platforms Team <platforms-team.customer-products@ft.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"zod": "^3.22.4"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@dotcom-tool-kit/base": "^1.1.
|
|
34
|
-
"@dotcom-tool-kit/config": "^1.0.
|
|
33
|
+
"@dotcom-tool-kit/base": "^1.1.5",
|
|
34
|
+
"@dotcom-tool-kit/config": "^1.0.8",
|
|
35
35
|
"@dotcom-tool-kit/conflict": "^1.0.0",
|
|
36
36
|
"@dotcom-tool-kit/error": "^4.1.0",
|
|
37
|
-
"@dotcom-tool-kit/logger": "^4.1.
|
|
37
|
+
"@dotcom-tool-kit/logger": "^4.1.1",
|
|
38
38
|
"@dotcom-tool-kit/plugin": "^1.0.0",
|
|
39
39
|
"@dotcom-tool-kit/state": "^4.1.0",
|
|
40
40
|
"@dotcom-tool-kit/validated": "^1.0.2",
|