@instructure/console 8.12.1-snapshot.7 → 8.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/es/console.js +56 -9
- package/es/macro.js +4 -5
- package/lib/console.js +57 -10
- package/lib/index.js +28 -28
- package/lib/macro.js +4 -5
- package/package.json +3 -4
- package/LICENSE.md +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [8.13.0](https://github.com/instructure/instructure-ui/compare/v8.12.0...v8.13.0) (2021-12-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/console
|
|
9
|
+
|
|
6
10
|
# [8.12.0](https://github.com/instructure/instructure-ui/compare/v8.11.1...v8.12.0) (2021-11-17)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/console
|
package/es/console.js
CHANGED
|
@@ -46,10 +46,15 @@ function getRenderStack() {
|
|
|
46
46
|
*/
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
function logMessage(level, withRenderStack, condition, message
|
|
49
|
+
function logMessage(level, withRenderStack, condition, message) {
|
|
50
50
|
if (process.env.NODE_ENV !== 'production' && !condition) {
|
|
51
51
|
if (typeof console[level] === 'function') {
|
|
52
52
|
const renderStack = withRenderStack ? getRenderStack() : '';
|
|
53
|
+
|
|
54
|
+
for (var _len = arguments.length, args = new Array(_len > 4 ? _len - 4 : 0), _key = 4; _key < _len; _key++) {
|
|
55
|
+
args[_key - 4] = arguments[_key];
|
|
56
|
+
}
|
|
57
|
+
|
|
53
58
|
console[level](`Warning: ${message}`, ...args, renderStack);
|
|
54
59
|
} else {
|
|
55
60
|
throw new Error(`'${level}' is not a valid console method!`);
|
|
@@ -57,8 +62,12 @@ function logMessage(level, withRenderStack, condition, message, ...args) {
|
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
|
|
60
|
-
function logDeprecated(condition, message
|
|
65
|
+
function logDeprecated(condition, message) {
|
|
61
66
|
if (!process.env.OMIT_INSTUI_DEPRECATION_WARNINGS) {
|
|
67
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
68
|
+
args[_key2 - 2] = arguments[_key2];
|
|
69
|
+
}
|
|
70
|
+
|
|
62
71
|
logMessage('warn', true, condition, message, ...args);
|
|
63
72
|
} else if (!condition && !loggedInitialDeprecationWarning) {
|
|
64
73
|
loggedInitialDeprecationWarning = true;
|
|
@@ -66,11 +75,49 @@ function logDeprecated(condition, message, ...args) {
|
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
77
|
|
|
69
|
-
export const error = (condition, message
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
export const error = function (condition, message) {
|
|
79
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
80
|
+
args[_key3 - 2] = arguments[_key3];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return logMessage('error', true, condition, message, ...args);
|
|
84
|
+
};
|
|
85
|
+
export const warn = function (condition, message) {
|
|
86
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
|
|
87
|
+
args[_key4 - 2] = arguments[_key4];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return logMessage('warn', true, condition, message, ...args);
|
|
91
|
+
};
|
|
92
|
+
export const warnDeprecated = function (condition, message) {
|
|
93
|
+
for (var _len5 = arguments.length, args = new Array(_len5 > 2 ? _len5 - 2 : 0), _key5 = 2; _key5 < _len5; _key5++) {
|
|
94
|
+
args[_key5 - 2] = arguments[_key5];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return logDeprecated(condition, message, ...args);
|
|
98
|
+
};
|
|
99
|
+
export const info = function () {
|
|
100
|
+
return console.info(...arguments);
|
|
101
|
+
};
|
|
102
|
+
export const assert = function (condition) {
|
|
103
|
+
for (var _len6 = arguments.length, data = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
|
104
|
+
data[_key6 - 1] = arguments[_key6];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return console.assert(condition, data);
|
|
108
|
+
};
|
|
109
|
+
export const debug = function (message) {
|
|
110
|
+
for (var _len7 = arguments.length, optionalParams = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
|
|
111
|
+
optionalParams[_key7 - 1] = arguments[_key7];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return console.debug(message, optionalParams);
|
|
115
|
+
};
|
|
116
|
+
export const log = function (message) {
|
|
117
|
+
for (var _len8 = arguments.length, optionalParams = new Array(_len8 > 1 ? _len8 - 1 : 0), _key8 = 1; _key8 < _len8; _key8++) {
|
|
118
|
+
optionalParams[_key8 - 1] = arguments[_key8];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return console.log(message, optionalParams);
|
|
122
|
+
};
|
|
76
123
|
/* eslint-enable no-console */
|
package/es/macro.js
CHANGED
|
@@ -29,11 +29,10 @@ const annotateAsPure = require('@babel/helper-annotate-as-pure').default;
|
|
|
29
29
|
const _require2 = require('@babel/helper-module-imports'),
|
|
30
30
|
addNamed = _require2.addNamed;
|
|
31
31
|
|
|
32
|
-
function macro({
|
|
33
|
-
babel,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}) {
|
|
32
|
+
function macro(_ref) {
|
|
33
|
+
let babel = _ref.babel,
|
|
34
|
+
references = _ref.references,
|
|
35
|
+
state = _ref.state;
|
|
37
36
|
Object.keys(references).forEach(referenceKey => {
|
|
38
37
|
const runtimeNode = addNamed(state.file.path, referenceKey, '@instructure/console');
|
|
39
38
|
const t = babel.types;
|
package/lib/console.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.warnDeprecated = exports.warn = exports.log = exports.info = exports.error = exports.debug = exports.assert = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
@@ -56,10 +56,15 @@ function getRenderStack() {
|
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
function logMessage(level, withRenderStack, condition, message
|
|
59
|
+
function logMessage(level, withRenderStack, condition, message) {
|
|
60
60
|
if (process.env.NODE_ENV !== 'production' && !condition) {
|
|
61
61
|
if (typeof console[level] === 'function') {
|
|
62
62
|
const renderStack = withRenderStack ? getRenderStack() : '';
|
|
63
|
+
|
|
64
|
+
for (var _len = arguments.length, args = new Array(_len > 4 ? _len - 4 : 0), _key = 4; _key < _len; _key++) {
|
|
65
|
+
args[_key - 4] = arguments[_key];
|
|
66
|
+
}
|
|
67
|
+
|
|
63
68
|
console[level](`Warning: ${message}`, ...args, renderStack);
|
|
64
69
|
} else {
|
|
65
70
|
throw new Error(`'${level}' is not a valid console method!`);
|
|
@@ -67,8 +72,12 @@ function logMessage(level, withRenderStack, condition, message, ...args) {
|
|
|
67
72
|
}
|
|
68
73
|
}
|
|
69
74
|
|
|
70
|
-
function logDeprecated(condition, message
|
|
75
|
+
function logDeprecated(condition, message) {
|
|
71
76
|
if (!process.env.OMIT_INSTUI_DEPRECATION_WARNINGS) {
|
|
77
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
78
|
+
args[_key2 - 2] = arguments[_key2];
|
|
79
|
+
}
|
|
80
|
+
|
|
72
81
|
logMessage('warn', true, condition, message, ...args);
|
|
73
82
|
} else if (!condition && !loggedInitialDeprecationWarning) {
|
|
74
83
|
loggedInitialDeprecationWarning = true;
|
|
@@ -76,31 +85,69 @@ function logDeprecated(condition, message, ...args) {
|
|
|
76
85
|
}
|
|
77
86
|
}
|
|
78
87
|
|
|
79
|
-
const error = (condition, message
|
|
88
|
+
const error = function (condition, message) {
|
|
89
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
90
|
+
args[_key3 - 2] = arguments[_key3];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return logMessage('error', true, condition, message, ...args);
|
|
94
|
+
};
|
|
80
95
|
|
|
81
96
|
exports.error = error;
|
|
82
97
|
|
|
83
|
-
const warn = (condition, message
|
|
98
|
+
const warn = function (condition, message) {
|
|
99
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
|
|
100
|
+
args[_key4 - 2] = arguments[_key4];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return logMessage('warn', true, condition, message, ...args);
|
|
104
|
+
};
|
|
84
105
|
|
|
85
106
|
exports.warn = warn;
|
|
86
107
|
|
|
87
|
-
const warnDeprecated = (condition, message
|
|
108
|
+
const warnDeprecated = function (condition, message) {
|
|
109
|
+
for (var _len5 = arguments.length, args = new Array(_len5 > 2 ? _len5 - 2 : 0), _key5 = 2; _key5 < _len5; _key5++) {
|
|
110
|
+
args[_key5 - 2] = arguments[_key5];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return logDeprecated(condition, message, ...args);
|
|
114
|
+
};
|
|
88
115
|
|
|
89
116
|
exports.warnDeprecated = warnDeprecated;
|
|
90
117
|
|
|
91
|
-
const info = (
|
|
118
|
+
const info = function () {
|
|
119
|
+
return console.info(...arguments);
|
|
120
|
+
};
|
|
92
121
|
|
|
93
122
|
exports.info = info;
|
|
94
123
|
|
|
95
|
-
const assert = (condition
|
|
124
|
+
const assert = function (condition) {
|
|
125
|
+
for (var _len6 = arguments.length, data = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
|
126
|
+
data[_key6 - 1] = arguments[_key6];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return console.assert(condition, data);
|
|
130
|
+
};
|
|
96
131
|
|
|
97
132
|
exports.assert = assert;
|
|
98
133
|
|
|
99
|
-
const debug = (message
|
|
134
|
+
const debug = function (message) {
|
|
135
|
+
for (var _len7 = arguments.length, optionalParams = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
|
|
136
|
+
optionalParams[_key7 - 1] = arguments[_key7];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return console.debug(message, optionalParams);
|
|
140
|
+
};
|
|
100
141
|
|
|
101
142
|
exports.debug = debug;
|
|
102
143
|
|
|
103
|
-
const log = (message
|
|
144
|
+
const log = function (message) {
|
|
145
|
+
for (var _len8 = arguments.length, optionalParams = new Array(_len8 > 1 ? _len8 - 1 : 0), _key8 = 1; _key8 < _len8; _key8++) {
|
|
146
|
+
optionalParams[_key8 - 1] = arguments[_key8];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return console.log(message, optionalParams);
|
|
150
|
+
};
|
|
104
151
|
/* eslint-enable no-console */
|
|
105
152
|
|
|
106
153
|
|
package/lib/index.js
CHANGED
|
@@ -3,88 +3,88 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "assert", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _console2.assert;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "consoleLog", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return _console.
|
|
15
|
+
return _console.log;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
18
|
+
Object.defineProperty(exports, "debug", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
21
|
-
return
|
|
21
|
+
return _console2.debug;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "error", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function () {
|
|
27
|
-
return
|
|
27
|
+
return _console2.error;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "info", {
|
|
31
31
|
enumerable: true,
|
|
32
32
|
get: function () {
|
|
33
|
-
return
|
|
33
|
+
return _console2.info;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
Object.defineProperty(exports, "
|
|
36
|
+
Object.defineProperty(exports, "log", {
|
|
37
37
|
enumerable: true,
|
|
38
38
|
get: function () {
|
|
39
|
-
return
|
|
39
|
+
return _console2.log;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
Object.defineProperty(exports, "
|
|
42
|
+
Object.defineProperty(exports, "logAssert", {
|
|
43
43
|
enumerable: true,
|
|
44
44
|
get: function () {
|
|
45
|
-
return _console.
|
|
45
|
+
return _console.assert;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
Object.defineProperty(exports, "
|
|
48
|
+
Object.defineProperty(exports, "logDebug", {
|
|
49
49
|
enumerable: true,
|
|
50
50
|
get: function () {
|
|
51
|
-
return
|
|
51
|
+
return _console.debug;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
Object.defineProperty(exports, "
|
|
54
|
+
Object.defineProperty(exports, "logError", {
|
|
55
55
|
enumerable: true,
|
|
56
56
|
get: function () {
|
|
57
|
-
return
|
|
57
|
+
return _console.error;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
Object.defineProperty(exports, "
|
|
60
|
+
Object.defineProperty(exports, "logInfo", {
|
|
61
61
|
enumerable: true,
|
|
62
62
|
get: function () {
|
|
63
|
-
return
|
|
63
|
+
return _console.info;
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
-
Object.defineProperty(exports, "
|
|
66
|
+
Object.defineProperty(exports, "logWarn", {
|
|
67
67
|
enumerable: true,
|
|
68
68
|
get: function () {
|
|
69
|
-
return
|
|
69
|
+
return _console.warn;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
Object.defineProperty(exports, "
|
|
72
|
+
Object.defineProperty(exports, "logWarnDeprecated", {
|
|
73
73
|
enumerable: true,
|
|
74
74
|
get: function () {
|
|
75
|
-
return
|
|
75
|
+
return _console.warnDeprecated;
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
|
-
Object.defineProperty(exports, "
|
|
78
|
+
Object.defineProperty(exports, "warn", {
|
|
79
79
|
enumerable: true,
|
|
80
80
|
get: function () {
|
|
81
|
-
return _console2.
|
|
81
|
+
return _console2.warn;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
Object.defineProperty(exports, "
|
|
84
|
+
Object.defineProperty(exports, "warnDeprecated", {
|
|
85
85
|
enumerable: true,
|
|
86
86
|
get: function () {
|
|
87
|
-
return _console2.
|
|
87
|
+
return _console2.warnDeprecated;
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
|
package/lib/macro.js
CHANGED
|
@@ -31,11 +31,10 @@ const annotateAsPure = require('@babel/helper-annotate-as-pure').default;
|
|
|
31
31
|
const _require2 = require('@babel/helper-module-imports'),
|
|
32
32
|
addNamed = _require2.addNamed;
|
|
33
33
|
|
|
34
|
-
function macro({
|
|
35
|
-
babel,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}) {
|
|
34
|
+
function macro(_ref) {
|
|
35
|
+
let babel = _ref.babel,
|
|
36
|
+
references = _ref.references,
|
|
37
|
+
state = _ref.state;
|
|
39
38
|
Object.keys(references).forEach(referenceKey => {
|
|
40
39
|
const runtimeNode = addNamed(state.file.path, referenceKey, '@instructure/console');
|
|
41
40
|
const t = babel.types;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/console",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.13.0",
|
|
4
4
|
"description": "A babel macro made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@instructure/ui-babel-preset": "8.
|
|
27
|
+
"@instructure/ui-babel-preset": "8.13.0",
|
|
28
28
|
"@types/babel-plugin-macros": "^2.8.4"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
@@ -37,6 +37,5 @@
|
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
|
-
}
|
|
41
|
-
"gitHead": "1e7ac821932a91fe9ef761c96f747c7ea1f3925a"
|
|
40
|
+
}
|
|
42
41
|
}
|
package/LICENSE.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: The MIT License (MIT)
|
|
3
|
-
category: Getting Started
|
|
4
|
-
order: 9
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# The MIT License (MIT)
|
|
8
|
-
|
|
9
|
-
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
-
|
|
11
|
-
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
-
in the Software without restriction, including without limitation the rights
|
|
14
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
-
furnished to do so, subject to the following conditions.**
|
|
17
|
-
|
|
18
|
-
The above copyright notice and this permission notice shall be included in all
|
|
19
|
-
copies or substantial portions of the Software.
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
-
SOFTWARE.
|