@hubspot/ui-extensions-dev-server 0.6.1-next.9 → 0.7.1
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/cli/run.js +1 -4
- package/cli/utils.js +1 -6
- package/lib/DevModeInterface.js +7 -33
- package/lib/build.js +8 -14
- package/lib/dev.js +4 -6
- package/lib/plugins/codeInjectionPlugin.js +7 -4
- package/lib/plugins/devBuildPlugin.js +9 -9
- package/lib/plugins/manifestPlugin.js +2 -1
- package/lib/server.js +8 -12
- package/package.json +4 -4
- package/cli/logger.js +0 -19
package/cli/run.js
CHANGED
|
@@ -7,7 +7,6 @@ const {
|
|
|
7
7
|
DevModeInterface,
|
|
8
8
|
} = require('../index');
|
|
9
9
|
|
|
10
|
-
const logger = require('./logger');
|
|
11
10
|
const path = require('path');
|
|
12
11
|
const { MAIN_APP_CONFIG, OUTPUT_DIR } = require('../lib/constants');
|
|
13
12
|
const inquirer = require('inquirer');
|
|
@@ -15,7 +14,7 @@ const { loadConfigByPath, loadExtensionConfig } = require('./config');
|
|
|
15
14
|
|
|
16
15
|
// eslint-disable-next-line no-floating-promise/no-floating-promise
|
|
17
16
|
(async () => {
|
|
18
|
-
const { DEV_MODE, BUILD_MODE, extension, help
|
|
17
|
+
const { DEV_MODE, BUILD_MODE, extension, help } = parseArgs();
|
|
19
18
|
|
|
20
19
|
if (help || !(DEV_MODE || BUILD_MODE)) {
|
|
21
20
|
showHelp(OUTPUT_DIR);
|
|
@@ -31,7 +30,6 @@ const { loadConfigByPath, loadExtensionConfig } = require('./config');
|
|
|
31
30
|
allExtensionsConfig[path.join(extensionPath, extension)];
|
|
32
31
|
}
|
|
33
32
|
await DevModeInterface.setup({
|
|
34
|
-
alpha,
|
|
35
33
|
promptUser: inquirer.createPromptModule(),
|
|
36
34
|
components: {
|
|
37
35
|
[appConfig.name]: {
|
|
@@ -40,7 +38,6 @@ const { loadConfigByPath, loadExtensionConfig } = require('./config');
|
|
|
40
38
|
},
|
|
41
39
|
},
|
|
42
40
|
extensionConfig,
|
|
43
|
-
logger,
|
|
44
41
|
});
|
|
45
42
|
|
|
46
43
|
await DevModeInterface.start({});
|
package/cli/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const logger = require('
|
|
1
|
+
const { logger } = require('@hubspot/cli-lib/logger');
|
|
2
2
|
const commandLineArgs = require('command-line-args');
|
|
3
3
|
const commandLineUsage = require('command-line-usage');
|
|
4
4
|
|
|
@@ -14,7 +14,6 @@ function parseArgs() {
|
|
|
14
14
|
const optionDefinitions = [
|
|
15
15
|
{ name: 'port', alias: 'p', type: Number },
|
|
16
16
|
{ name: 'extension', alias: 'e', type: String },
|
|
17
|
-
{ name: 'alpha', type: Boolean },
|
|
18
17
|
{ name: 'help', alias: 'h', type: Boolean },
|
|
19
18
|
];
|
|
20
19
|
|
|
@@ -49,10 +48,6 @@ function showHelp(OUTPUT_DIR) {
|
|
|
49
48
|
description:
|
|
50
49
|
'The extension entrypoint file to build or start local development for',
|
|
51
50
|
},
|
|
52
|
-
{
|
|
53
|
-
name: 'alpha',
|
|
54
|
-
description: 'Run app functions locally.',
|
|
55
|
-
},
|
|
56
51
|
{
|
|
57
52
|
name: 'help',
|
|
58
53
|
alias: 'h',
|
package/lib/DevModeInterface.js
CHANGED
|
@@ -2,23 +2,9 @@ const { startDevMode } = require('./dev');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const { OUTPUT_DIR } = require('./constants');
|
|
4
4
|
const { loadExtensionConfig } = require('../cli/config');
|
|
5
|
+
const { logger, setLogLevel, LOG_LEVEL } = require('@hubspot/cli-lib/logger');
|
|
5
6
|
|
|
6
7
|
class DevModeInterface {
|
|
7
|
-
constructor() {
|
|
8
|
-
this._setupLogger(console);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
_setupLogger(_logger) {
|
|
12
|
-
this.logger = {
|
|
13
|
-
..._logger,
|
|
14
|
-
debug: (...args) => {
|
|
15
|
-
if (this.debug) {
|
|
16
|
-
_logger.debug(...args);
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
8
|
_setDataFromExtensionConfig(extensionConfig) {
|
|
23
9
|
this.config = extensionConfig;
|
|
24
10
|
this.appName = extensionConfig.data.appName;
|
|
@@ -55,26 +41,16 @@ class DevModeInterface {
|
|
|
55
41
|
}
|
|
56
42
|
|
|
57
43
|
async setup({
|
|
58
|
-
// This flag is used for whether to enable local serverless on the dev server pre-INBOUND.
|
|
59
|
-
// If the user runs `hs project dev --local-all`, the flag is set to true.
|
|
60
|
-
// By INBOUND, we will remove the flag and make the dev server handle both extensions
|
|
61
|
-
// and app functions locally.
|
|
62
|
-
alpha = false,
|
|
63
44
|
debug = false,
|
|
64
45
|
accountId,
|
|
65
46
|
httpClient,
|
|
66
47
|
promptUser,
|
|
67
48
|
components,
|
|
68
49
|
extensionConfig,
|
|
69
|
-
logger,
|
|
70
50
|
}) {
|
|
71
|
-
|
|
72
|
-
this.debug = debug;
|
|
51
|
+
setLogLevel(debug ? LOG_LEVEL.DEBUG : LOG_LEVEL.LOG);
|
|
73
52
|
this.accountId = accountId;
|
|
74
53
|
this.httpClient = httpClient;
|
|
75
|
-
if (logger) {
|
|
76
|
-
this._setupLogger(logger);
|
|
77
|
-
}
|
|
78
54
|
if (extensionConfig) {
|
|
79
55
|
this._setDataFromExtensionConfig(extensionConfig);
|
|
80
56
|
return;
|
|
@@ -97,8 +73,10 @@ class DevModeInterface {
|
|
|
97
73
|
}
|
|
98
74
|
}
|
|
99
75
|
|
|
100
|
-
async start({ debug }) {
|
|
101
|
-
|
|
76
|
+
async start({ debug = null }) {
|
|
77
|
+
if (debug !== null) {
|
|
78
|
+
setLogLevel(debug ? LOG_LEVEL.DEBUG : LOG_LEVEL.LOG);
|
|
79
|
+
}
|
|
102
80
|
if (!this.config || !this.config.path) {
|
|
103
81
|
throw new Error(
|
|
104
82
|
'Unable to load the required extension configuration files'
|
|
@@ -111,20 +89,16 @@ class DevModeInterface {
|
|
|
111
89
|
app: { path: appPath },
|
|
112
90
|
accountId: this.accountId,
|
|
113
91
|
httpClient: this.httpClient,
|
|
114
|
-
enabled: !!this.alpha,
|
|
115
92
|
};
|
|
116
93
|
|
|
117
94
|
this.shutdown = await startDevMode({
|
|
118
95
|
extensionConfig: this.config,
|
|
119
96
|
outputDir: path.join(this.config.extensionPath, OUTPUT_DIR),
|
|
120
97
|
functionsConfig,
|
|
121
|
-
logger: this.logger,
|
|
122
98
|
root: appPath,
|
|
123
99
|
});
|
|
124
100
|
|
|
125
|
-
|
|
126
|
-
`Running extension '${this.title}' from app '${this.appName}'`
|
|
127
|
-
);
|
|
101
|
+
logger.info(`Running extension '${this.title}' from app '${this.appName}'`);
|
|
128
102
|
}
|
|
129
103
|
|
|
130
104
|
async cleanup() {
|
package/lib/build.js
CHANGED
|
@@ -11,7 +11,7 @@ const extensionErrorBaseMessage = `Supported file extensions are [${allowedExten
|
|
|
11
11
|
', '
|
|
12
12
|
)}], received:`;
|
|
13
13
|
|
|
14
|
-
async function buildAllExtensions({ outputDir
|
|
14
|
+
async function buildAllExtensions({ outputDir }) {
|
|
15
15
|
const config = loadConfig();
|
|
16
16
|
const extensionKeys = Object.keys(config);
|
|
17
17
|
for (let i = 0; i < extensionKeys.length; ++i) {
|
|
@@ -21,7 +21,6 @@ async function buildAllExtensions({ outputDir, logger = console }) {
|
|
|
21
21
|
file: data.module.file,
|
|
22
22
|
outputDir,
|
|
23
23
|
emptyOutDir: i === 0,
|
|
24
|
-
logger,
|
|
25
24
|
});
|
|
26
25
|
}
|
|
27
26
|
}
|
|
@@ -32,7 +31,6 @@ async function buildSingleExtension({
|
|
|
32
31
|
emptyOutDir = true,
|
|
33
32
|
minify = false,
|
|
34
33
|
root = process.cwd(), // This is the vite default, so using that as our default
|
|
35
|
-
logger = console,
|
|
36
34
|
}) {
|
|
37
35
|
const output = getUrlSafeFileName(file);
|
|
38
36
|
await build({
|
|
@@ -51,10 +49,7 @@ async function buildSingleExtension({
|
|
|
51
49
|
},
|
|
52
50
|
rollupOptions: {
|
|
53
51
|
...ROLLUP_OPTIONS,
|
|
54
|
-
plugins: [
|
|
55
|
-
manifestPlugin({ minify, output, logger }),
|
|
56
|
-
codeInjectionPlugin({ file }),
|
|
57
|
-
],
|
|
52
|
+
plugins: [manifestPlugin({ output }), codeInjectionPlugin({ file })],
|
|
58
53
|
},
|
|
59
54
|
outDir: outputDir,
|
|
60
55
|
emptyOutDir,
|
|
@@ -63,24 +58,23 @@ async function buildSingleExtension({
|
|
|
63
58
|
});
|
|
64
59
|
}
|
|
65
60
|
|
|
66
|
-
async function remoteBuild(
|
|
67
|
-
root,
|
|
68
|
-
entryPoint,
|
|
69
|
-
outputDir = OUTPUT_DIR,
|
|
70
|
-
logger = console
|
|
71
|
-
) {
|
|
61
|
+
async function remoteBuild(root, entryPoint, outputDir = OUTPUT_DIR) {
|
|
72
62
|
const fileInfo = path.parse(entryPoint);
|
|
73
63
|
|
|
74
64
|
if (!allowedExtensions.includes(fileInfo.ext)) {
|
|
75
65
|
throw new Error(`${extensionErrorBaseMessage} ${fileInfo.ext}`);
|
|
76
66
|
}
|
|
77
67
|
|
|
68
|
+
const output = getUrlSafeFileName(entryPoint);
|
|
78
69
|
await buildSingleExtension({
|
|
79
70
|
file: entryPoint,
|
|
71
|
+
outputFileName: output,
|
|
80
72
|
outputDir,
|
|
73
|
+
plugins: {
|
|
74
|
+
rollup: [manifestPlugin({ minify: true, output })],
|
|
75
|
+
},
|
|
81
76
|
minify: true,
|
|
82
77
|
root,
|
|
83
|
-
logger
|
|
84
78
|
});
|
|
85
79
|
}
|
|
86
80
|
|
package/lib/dev.js
CHANGED
|
@@ -14,7 +14,6 @@ async function _createViteDevServer(
|
|
|
14
14
|
extensionConfig,
|
|
15
15
|
websocketPort,
|
|
16
16
|
baseMessage,
|
|
17
|
-
logger,
|
|
18
17
|
root
|
|
19
18
|
) {
|
|
20
19
|
return await createServer({
|
|
@@ -27,7 +26,10 @@ async function _createViteDevServer(
|
|
|
27
26
|
port: websocketPort,
|
|
28
27
|
},
|
|
29
28
|
watch: {
|
|
30
|
-
ignored: [
|
|
29
|
+
ignored: [
|
|
30
|
+
path.join(outputDir, '/**/*'),
|
|
31
|
+
'**/src/app/app.functions/**/*',
|
|
32
|
+
],
|
|
31
33
|
},
|
|
32
34
|
},
|
|
33
35
|
build: {
|
|
@@ -41,7 +43,6 @@ async function _createViteDevServer(
|
|
|
41
43
|
extensionConfig,
|
|
42
44
|
outputDir,
|
|
43
45
|
baseMessage,
|
|
44
|
-
logger,
|
|
45
46
|
}),
|
|
46
47
|
],
|
|
47
48
|
clearScreen: false,
|
|
@@ -51,7 +52,6 @@ async function _createViteDevServer(
|
|
|
51
52
|
async function startDevMode({
|
|
52
53
|
extensionConfig,
|
|
53
54
|
functionsConfig,
|
|
54
|
-
logger,
|
|
55
55
|
outputDir = OUTPUT_DIR,
|
|
56
56
|
expressPort = VITE_DEFAULT_PORT,
|
|
57
57
|
webSocketPort = WEBSOCKET_PORT,
|
|
@@ -72,7 +72,6 @@ async function startDevMode({
|
|
|
72
72
|
extensionConfig,
|
|
73
73
|
webSocketPort,
|
|
74
74
|
baseMessage,
|
|
75
|
-
logger,
|
|
76
75
|
root
|
|
77
76
|
);
|
|
78
77
|
|
|
@@ -83,7 +82,6 @@ async function startDevMode({
|
|
|
83
82
|
baseMessage,
|
|
84
83
|
viteDevServer,
|
|
85
84
|
functionsConfig,
|
|
86
|
-
logger,
|
|
87
85
|
});
|
|
88
86
|
}
|
|
89
87
|
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
|
|
3
|
-
function codeInjectionPlugin() {
|
|
3
|
+
function codeInjectionPlugin(options = {}) {
|
|
4
|
+
const { file, root = process.cwd() } = options;
|
|
4
5
|
return {
|
|
5
6
|
name: 'ui-extensions-code-injection-plugin',
|
|
6
7
|
enforce: 'post', // run after default rollup plugins
|
|
7
|
-
transform(code,
|
|
8
|
-
const
|
|
8
|
+
transform(code, fileBeingTransformed) {
|
|
9
|
+
const absoluteFilePath = path.isAbsolute(file)
|
|
10
|
+
? file
|
|
11
|
+
: path.join(root, file);
|
|
9
12
|
|
|
10
|
-
if (
|
|
13
|
+
if (fileBeingTransformed !== absoluteFilePath) {
|
|
11
14
|
return { code, map: null }; // Not the file we care about, return the same code
|
|
12
15
|
}
|
|
13
16
|
|
|
@@ -2,10 +2,10 @@ const { ROLLUP_OPTIONS, WEBSOCKET_MESSAGE_VERSION } = require('../constants');
|
|
|
2
2
|
const { build } = require('vite');
|
|
3
3
|
const manifestPlugin = require('./manifestPlugin');
|
|
4
4
|
const { stripAnsiColorCodes } = require('../utils');
|
|
5
|
-
const
|
|
5
|
+
const { logger } = require('@hubspot/cli-lib/logger');
|
|
6
6
|
|
|
7
7
|
function devBuildPlugin(options = {}) {
|
|
8
|
-
const { extensionConfig, outputDir, baseMessage
|
|
8
|
+
const { extensionConfig, outputDir, baseMessage } = options;
|
|
9
9
|
const versionedBaseMessage = {
|
|
10
10
|
...baseMessage,
|
|
11
11
|
version: WEBSOCKET_MESSAGE_VERSION,
|
|
@@ -64,9 +64,7 @@ function devBuildPlugin(options = {}) {
|
|
|
64
64
|
manifestPlugin({
|
|
65
65
|
minify: false,
|
|
66
66
|
output: extensionConfig.output,
|
|
67
|
-
logger,
|
|
68
67
|
}),
|
|
69
|
-
codeInjectionPlugin({ file: extensionConfig.data.module.file }),
|
|
70
68
|
],
|
|
71
69
|
output: {
|
|
72
70
|
...ROLLUP_OPTIONS.output,
|
|
@@ -81,7 +79,7 @@ function devBuildPlugin(options = {}) {
|
|
|
81
79
|
});
|
|
82
80
|
return true;
|
|
83
81
|
} catch (error) {
|
|
84
|
-
logger.
|
|
82
|
+
logger.debug(error);
|
|
85
83
|
handleBuildError(error, server);
|
|
86
84
|
return false;
|
|
87
85
|
}
|
|
@@ -103,7 +101,7 @@ function devBuildPlugin(options = {}) {
|
|
|
103
101
|
});
|
|
104
102
|
});
|
|
105
103
|
localServer.ws.on('build', async () => {
|
|
106
|
-
logger.
|
|
104
|
+
logger.debug('Browser has requested a build, rebuilding');
|
|
107
105
|
const successful = await devBuild(localServer);
|
|
108
106
|
if (successful) {
|
|
109
107
|
server.ws.send({
|
|
@@ -121,12 +119,14 @@ function devBuildPlugin(options = {}) {
|
|
|
121
119
|
return [];
|
|
122
120
|
}
|
|
123
121
|
|
|
122
|
+
logger.info(`Extension ${extensionConfig.data.title} updated, compiled`);
|
|
123
|
+
|
|
124
124
|
if (server.ws.clients.size === 0) {
|
|
125
|
-
logger.
|
|
125
|
+
logger.debug('Bundle updated, no browsers connected to notify');
|
|
126
126
|
return [];
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
logger.
|
|
129
|
+
logger.debug('Bundle updated, notifying connected browsers');
|
|
130
130
|
server.ws.send({
|
|
131
131
|
...versionedBaseMessage,
|
|
132
132
|
event: 'update',
|
|
@@ -137,7 +137,7 @@ function devBuildPlugin(options = {}) {
|
|
|
137
137
|
if (error) {
|
|
138
138
|
logger.error(error);
|
|
139
139
|
}
|
|
140
|
-
logger.
|
|
140
|
+
logger.debug('Sending shutdown message to connected browsers');
|
|
141
141
|
if (localServer && localServer.ws) {
|
|
142
142
|
localServer.ws.send({
|
|
143
143
|
...versionedBaseMessage,
|
|
@@ -2,6 +2,7 @@ const { readFileSync } = require('fs');
|
|
|
2
2
|
const { normalize } = require('path');
|
|
3
3
|
const { MANIFEST_FILE } = require('../constants');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const { logger } = require('@hubspot/cli-lib/logger');
|
|
5
6
|
|
|
6
7
|
const PACKAGE_LOCK_FILE = 'package-lock.json';
|
|
7
8
|
const PACKAGE_FILE = 'package.json';
|
|
@@ -12,7 +13,7 @@ function manifestPlugin(options = {}) {
|
|
|
12
13
|
name: 'ui-extensions-manifest-generation-plugin',
|
|
13
14
|
enforce: 'post', // run after default rollup plugins
|
|
14
15
|
generateBundle(_rollupOptions, bundle) {
|
|
15
|
-
const { output, minify = false
|
|
16
|
+
const { output, minify = false } = options;
|
|
16
17
|
try {
|
|
17
18
|
const filename = path.parse(output).name;
|
|
18
19
|
const manifest = _generateManifestContents(bundle);
|
package/lib/server.js
CHANGED
|
@@ -5,6 +5,7 @@ const extensionsService = require('./extensionsService');
|
|
|
5
5
|
const {
|
|
6
6
|
AppFunctionExecutionService,
|
|
7
7
|
} = require('@hubspot/app-functions-dev-server');
|
|
8
|
+
const { logger } = require('@hubspot/cli-lib/logger');
|
|
8
9
|
|
|
9
10
|
function startDevServer({
|
|
10
11
|
outputDir,
|
|
@@ -13,7 +14,6 @@ function startDevServer({
|
|
|
13
14
|
baseMessage,
|
|
14
15
|
viteDevServer,
|
|
15
16
|
functionsConfig,
|
|
16
|
-
logger,
|
|
17
17
|
}) {
|
|
18
18
|
const app = express();
|
|
19
19
|
|
|
@@ -21,22 +21,18 @@ function startDevServer({
|
|
|
21
21
|
app.use(cors());
|
|
22
22
|
app.use(express.static(outputDir));
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
AppFunctionExecutionService({ ...functionsConfig, logger })
|
|
30
|
-
);
|
|
31
|
-
logger.info('Serving app functions locally');
|
|
32
|
-
}
|
|
24
|
+
app.use(
|
|
25
|
+
'/api/crm-extensibility/execution/internal/v3',
|
|
26
|
+
AppFunctionExecutionService({ ...functionsConfig, logger })
|
|
27
|
+
);
|
|
28
|
+
logger.info('Serving app functions locally');
|
|
33
29
|
|
|
34
30
|
const endpointsAdded = extensionsService.add(
|
|
35
31
|
app,
|
|
36
32
|
webSocketPort,
|
|
37
33
|
outputDir,
|
|
38
34
|
baseMessage,
|
|
39
|
-
|
|
35
|
+
SERVER_CAPABILITIES
|
|
40
36
|
);
|
|
41
37
|
|
|
42
38
|
endpointsAdded.forEach(endpoint => {
|
|
@@ -54,7 +50,7 @@ function startDevServer({
|
|
|
54
50
|
await viteDevServer.pluginContainer.close();
|
|
55
51
|
// Stop new connections to express server
|
|
56
52
|
server.close(() => {});
|
|
57
|
-
logger.info('
|
|
53
|
+
logger.info('Extension dev server done cleaning up');
|
|
58
54
|
};
|
|
59
55
|
}
|
|
60
56
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/ui-extensions-dev-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"cli/config.js",
|
|
19
|
-
"cli/logger.js",
|
|
20
19
|
"cli/run.js",
|
|
21
20
|
"cli/utils.js",
|
|
22
21
|
"lib/plugins/*",
|
|
@@ -33,7 +32,8 @@
|
|
|
33
32
|
],
|
|
34
33
|
"license": "MIT",
|
|
35
34
|
"dependencies": {
|
|
36
|
-
"@hubspot/app-functions-dev-server": "^0.
|
|
35
|
+
"@hubspot/app-functions-dev-server": "^0.7.0",
|
|
36
|
+
"@hubspot/cli-lib": "^4.1.6",
|
|
37
37
|
"command-line-args": "^5.2.1",
|
|
38
38
|
"command-line-usage": "^7.0.1",
|
|
39
39
|
"console-log-colors": "^0.4.0",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"optional": true
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "f3c6bfa9f758bdb23179e953a1826d1f0c3bd90f"
|
|
71
71
|
}
|
package/cli/logger.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const { cyan, red, yellow, magenta } = require('console-log-colors');
|
|
2
|
-
|
|
3
|
-
function info(message, ...data) {
|
|
4
|
-
console.log(cyan(message), ...data);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function error(message, ...data) {
|
|
8
|
-
console.error(red(message), ...data);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function warn(message, ...data) {
|
|
12
|
-
console.info(yellow(message), ...data);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function debug(message, ...data) {
|
|
16
|
-
console.debug(magenta(message), ...data);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
module.exports = { info, error, warn, debug };
|