@atlaskit/adf-utils 17.1.3 → 17.1.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/CHANGELOG.md +12 -0
- package/builders/package.json +8 -1
- package/codemods/17.0.0-update-imports-to-new-entry-points.ts +2 -3
- package/dist/cjs/transforms/helpers.js +14 -0
- package/dist/cjs/transforms/invalid-media-content-transform.js +103 -0
- package/dist/cjs/transforms/nodes-missing-content-transform.js +26 -20
- package/dist/cjs/transforms.js +9 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/transforms/helpers.js +5 -0
- package/dist/es2019/transforms/invalid-media-content-transform.js +77 -0
- package/dist/es2019/transforms/nodes-missing-content-transform.js +20 -17
- package/dist/es2019/transforms.js +2 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/transforms/helpers.js +5 -0
- package/dist/esm/transforms/invalid-media-content-transform.js +91 -0
- package/dist/esm/transforms/nodes-missing-content-transform.js +22 -17
- package/dist/esm/transforms.js +2 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/transforms/helpers.d.ts +2 -0
- package/dist/types/transforms/invalid-media-content-transform.d.ts +5 -0
- package/dist/types/transforms.d.ts +1 -0
- package/empty-adf/package.json +8 -1
- package/package.json +7 -4
- package/report.api.md +15 -2
- package/scrub/package.json +8 -1
- package/transforms/package.json +8 -1
- package/traverse/package.json +8 -1
- package/types/package.json +8 -1
- package/validator/package.json +8 -1
- package/validatorTypes/package.json +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/adf-utils
|
|
2
2
|
|
|
3
|
+
## 17.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`17014a9004c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/17014a9004c) - [ux] ED-15632 preprocess invalid media adf to avoid empty mediaSingle node and duplicated captions and media inside mediaSingle.The document will be transformed for this cases and validation error not thrown.When mediaSingle with empty content is encountered - it will be removed.When mediaSingle with duplicated captions or media nodes is encountered - duplicate captions or media nodes will be removed, prioritising removal of nodes with empty content first.
|
|
8
|
+
|
|
9
|
+
## 17.1.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
|
|
14
|
+
|
|
3
15
|
## 17.1.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/builders/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/builders.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/builders.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/builders.d.ts"
|
|
7
|
+
"types": "../dist/types/builders.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/builders.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -166,9 +166,8 @@ const entryPointChangeRequests: EntryPointChangeRequest[] = [
|
|
|
166
166
|
scrub,
|
|
167
167
|
];
|
|
168
168
|
|
|
169
|
-
export const entryPointChangeMigrates =
|
|
170
|
-
entryPointChangeRequests
|
|
171
|
-
);
|
|
169
|
+
export const entryPointChangeMigrates =
|
|
170
|
+
createMigratesFromEntryPointChangeRequests(entryPointChangeRequests);
|
|
172
171
|
|
|
173
172
|
const transformer = createTransformer(entryPointChangeMigrates);
|
|
174
173
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isEmpty = void 0;
|
|
7
|
+
|
|
8
|
+
var isEmpty = function isEmpty(node) {
|
|
9
|
+
var _node$content;
|
|
10
|
+
|
|
11
|
+
return !(node !== null && node !== void 0 && (_node$content = node.content) !== null && _node$content !== void 0 && _node$content.length);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.isEmpty = isEmpty;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.transformInvalidMediaContent = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
14
|
+
var _traverse = require("../traverse/traverse");
|
|
15
|
+
|
|
16
|
+
var _helpers = require("./helpers");
|
|
17
|
+
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
|
|
22
|
+
var getChildrenTypeCounts = function getChildrenTypeCounts(nodeContent, allowedTypes) {
|
|
23
|
+
var childrenTypes = {};
|
|
24
|
+
nodeContent.forEach(function (childNode, index) {
|
|
25
|
+
if (!(childNode !== null && childNode !== void 0 && childNode.type) || !allowedTypes.includes(childNode.type)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!childrenTypes[childNode.type]) {
|
|
30
|
+
childrenTypes[childNode.type] = 1;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
childrenTypes[childNode.type]++;
|
|
35
|
+
});
|
|
36
|
+
return childrenTypes;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var removeDuplicatedNodes = function removeDuplicatedNodes(type, content, predicate) {
|
|
40
|
+
var maxIterations = 10;
|
|
41
|
+
var childrenTypeCounts = getChildrenTypeCounts(content, [type])[type];
|
|
42
|
+
var firstPredicateNodeIndex = content.findIndex(predicate);
|
|
43
|
+
|
|
44
|
+
while (childrenTypeCounts > 1 && firstPredicateNodeIndex > -1 && maxIterations-- > 0) {
|
|
45
|
+
content.splice(firstPredicateNodeIndex, 1);
|
|
46
|
+
firstPredicateNodeIndex = content.findIndex(predicate);
|
|
47
|
+
childrenTypeCounts = getChildrenTypeCounts(content, [type])[type];
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* @param {{[type:string]:number}} allowedTypes - array types allowed to deduplicate
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
var deduplicateMediaSingleChildren = function deduplicateMediaSingleChildren(node, allowedTypes) {
|
|
56
|
+
if (!node.content) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var content = (0, _toConsumableArray2.default)(node.content);
|
|
61
|
+
Object.keys(allowedTypes).forEach(function (type) {
|
|
62
|
+
//prioritise removing empty nodes first
|
|
63
|
+
removeDuplicatedNodes(type, content, function (node) {
|
|
64
|
+
return (node === null || node === void 0 ? void 0 : node.type) === type && (0, _helpers.isEmpty)(node);
|
|
65
|
+
}); //remove other remaining dupicates
|
|
66
|
+
|
|
67
|
+
removeDuplicatedNodes(type, content, function (node) {
|
|
68
|
+
return (node === null || node === void 0 ? void 0 : node.type) === type;
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
return _objectSpread(_objectSpread({}, node), {}, {
|
|
72
|
+
content: content
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var transformInvalidMediaContent = function transformInvalidMediaContent(adf) {
|
|
77
|
+
var isTransformed = false;
|
|
78
|
+
var transformedAdf = (0, _traverse.traverse)(adf, {
|
|
79
|
+
mediaSingle: function mediaSingle(node) {
|
|
80
|
+
var _node$content;
|
|
81
|
+
|
|
82
|
+
if (!(node !== null && node !== void 0 && (_node$content = node.content) !== null && _node$content !== void 0 && _node$content.length)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
var disallowedDuplicateTypes = ['media', 'caption'];
|
|
87
|
+
var childrenTypes = getChildrenTypeCounts(node.content, disallowedDuplicateTypes);
|
|
88
|
+
|
|
89
|
+
if (Object.values(childrenTypes).some(function (occurences) {
|
|
90
|
+
return occurences > 1;
|
|
91
|
+
})) {
|
|
92
|
+
isTransformed = true;
|
|
93
|
+
return deduplicateMediaSingleChildren(node, childrenTypes);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
transformedAdf: transformedAdf,
|
|
99
|
+
isTransformed: isTransformed
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
exports.transformInvalidMediaContent = transformInvalidMediaContent;
|
|
@@ -15,6 +15,8 @@ var _traverse = require("../traverse/traverse");
|
|
|
15
15
|
|
|
16
16
|
var _builders = require("../builders");
|
|
17
17
|
|
|
18
|
+
var _helpers = require("./helpers");
|
|
19
|
+
|
|
18
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
21
|
|
|
20
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -43,15 +45,9 @@ var createValidEmptyContent = function createValidEmptyContent(node) {
|
|
|
43
45
|
}
|
|
44
46
|
};
|
|
45
47
|
|
|
46
|
-
var isEmpty = function isEmpty(node) {
|
|
47
|
-
var _node$content;
|
|
48
|
-
|
|
49
|
-
return ((_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.length) === 0;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
48
|
var fixIfTableCellInvalidEmpty = function fixIfTableCellInvalidEmpty(reportTransform) {
|
|
53
49
|
return function (node) {
|
|
54
|
-
if (isEmpty(node)) {
|
|
50
|
+
if ((0, _helpers.isEmpty)(node)) {
|
|
55
51
|
reportTransform();
|
|
56
52
|
return _objectSpread(_objectSpread({}, node), {}, {
|
|
57
53
|
content: createValidEmptyContent(node)
|
|
@@ -61,17 +57,17 @@ var fixIfTableCellInvalidEmpty = function fixIfTableCellInvalidEmpty(reportTrans
|
|
|
61
57
|
};
|
|
62
58
|
|
|
63
59
|
var hasNonListItemChildren = function hasNonListItemChildren(node) {
|
|
64
|
-
var _node$
|
|
60
|
+
var _node$content;
|
|
65
61
|
|
|
66
|
-
return (_node$
|
|
62
|
+
return (_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.some(function (node) {
|
|
67
63
|
return (node === null || node === void 0 ? void 0 : node.type) !== 'listItem';
|
|
68
64
|
});
|
|
69
65
|
};
|
|
70
66
|
|
|
71
67
|
var hasEmptyListItemChildren = function hasEmptyListItemChildren(node) {
|
|
72
|
-
var _node$
|
|
68
|
+
var _node$content2;
|
|
73
69
|
|
|
74
|
-
return (_node$
|
|
70
|
+
return (_node$content2 = node.content) === null || _node$content2 === void 0 ? void 0 : _node$content2.some(function (childNode) {
|
|
75
71
|
var _childNode$content2;
|
|
76
72
|
|
|
77
73
|
return (childNode === null || childNode === void 0 ? void 0 : childNode.type) === 'listItem' && !((_childNode$content2 = childNode.content) !== null && _childNode$content2 !== void 0 && _childNode$content2.length);
|
|
@@ -86,7 +82,7 @@ var tryCreateValidListItemWrappedChildren = function tryCreateValidListItemWrapp
|
|
|
86
82
|
switch (childNode.type) {
|
|
87
83
|
case 'listItem':
|
|
88
84
|
{
|
|
89
|
-
if (isEmpty(childNode)) {
|
|
85
|
+
if ((0, _helpers.isEmpty)(childNode)) {
|
|
90
86
|
var result = (0, _builders.listItem)([(0, _builders.paragraph)()]);
|
|
91
87
|
return result;
|
|
92
88
|
}
|
|
@@ -118,9 +114,9 @@ var fixIfListParentWithInvalidListItemChildren = function fixIfListParentWithInv
|
|
|
118
114
|
};
|
|
119
115
|
|
|
120
116
|
var hasNonTableRowChildren = function hasNonTableRowChildren(node) {
|
|
121
|
-
var _node$
|
|
117
|
+
var _node$content3;
|
|
122
118
|
|
|
123
|
-
return (_node$
|
|
119
|
+
return (_node$content3 = node.content) === null || _node$content3 === void 0 ? void 0 : _node$content3.some(function (node) {
|
|
124
120
|
return (node === null || node === void 0 ? void 0 : node.type) !== 'tableRow';
|
|
125
121
|
});
|
|
126
122
|
};
|
|
@@ -144,7 +140,7 @@ var tryCreateValidTableRowWrappedChildren = function tryCreateValidTableRowWrapp
|
|
|
144
140
|
|
|
145
141
|
case 'tableRow':
|
|
146
142
|
{
|
|
147
|
-
if (isEmpty(childNode)) {
|
|
143
|
+
if ((0, _helpers.isEmpty)(childNode)) {
|
|
148
144
|
return (0, _builders.tableRow)((0, _toConsumableArray2.default)(new Array(maxColsCount).fill((0, _builders.tableCell)({})((0, _builders.paragraph)()))));
|
|
149
145
|
}
|
|
150
146
|
|
|
@@ -161,12 +157,12 @@ var tryCreateValidTableRowWrappedChildren = function tryCreateValidTableRowWrapp
|
|
|
161
157
|
};
|
|
162
158
|
|
|
163
159
|
var hasEmptyTableRowChildren = function hasEmptyTableRowChildren(node) {
|
|
164
|
-
var _node$
|
|
160
|
+
var _node$content4;
|
|
165
161
|
|
|
166
|
-
return node === null || node === void 0 ? void 0 : (_node$
|
|
167
|
-
var _node$
|
|
162
|
+
return node === null || node === void 0 ? void 0 : (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
|
|
163
|
+
var _node$content5;
|
|
168
164
|
|
|
169
|
-
return (node === null || node === void 0 ? void 0 : node.type) === 'tableRow' && (node === null || node === void 0 ? void 0 : (_node$
|
|
165
|
+
return (node === null || node === void 0 ? void 0 : node.type) === 'tableRow' && (node === null || node === void 0 ? void 0 : (_node$content5 = node.content) === null || _node$content5 === void 0 ? void 0 : _node$content5.length) === 0;
|
|
170
166
|
});
|
|
171
167
|
};
|
|
172
168
|
|
|
@@ -181,6 +177,15 @@ var fixIfTableParentWithInvalidTableRowChildren = function fixIfTableParentWithI
|
|
|
181
177
|
};
|
|
182
178
|
};
|
|
183
179
|
|
|
180
|
+
var removeMediaSingleWithNoContent = function removeMediaSingleWithNoContent(reportTransform) {
|
|
181
|
+
return function (node) {
|
|
182
|
+
if ((0, _helpers.isEmpty)(node)) {
|
|
183
|
+
reportTransform();
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
|
|
184
189
|
var transformNodesMissingContent = function transformNodesMissingContent(adf) {
|
|
185
190
|
var isTransformed = false;
|
|
186
191
|
|
|
@@ -194,7 +199,8 @@ var transformNodesMissingContent = function transformNodesMissingContent(adf) {
|
|
|
194
199
|
transformedAdf = (0, _traverse.traverse)(transformedAdf || adf, {
|
|
195
200
|
bulletList: fixIfListParentWithInvalidListItemChildren(reportTransform),
|
|
196
201
|
orderedList: fixIfListParentWithInvalidListItemChildren(reportTransform),
|
|
197
|
-
table: fixIfTableParentWithInvalidTableRowChildren(reportTransform)
|
|
202
|
+
table: fixIfTableParentWithInvalidTableRowChildren(reportTransform),
|
|
203
|
+
mediaSingle: removeMediaSingleWithNoContent(reportTransform)
|
|
198
204
|
});
|
|
199
205
|
return {
|
|
200
206
|
transformedAdf: transformedAdf,
|
package/dist/cjs/transforms.js
CHANGED
|
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "transformIndentationMarks", {
|
|
|
15
15
|
return _indentationMarksTransform.transformIndentationMarks;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "transformInvalidMediaContent", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _invalidMediaContentTransform.transformInvalidMediaContent;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(exports, "transformMediaLinkMarks", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function get() {
|
|
@@ -42,4 +48,6 @@ var _dedupeMarksTransform = require("./transforms/dedupe-marks-transform");
|
|
|
42
48
|
|
|
43
49
|
var _nodesMissingContentTransform = require("./transforms/nodes-missing-content-transform");
|
|
44
50
|
|
|
45
|
-
var _indentationMarksTransform = require("./transforms/indentation-marks-transform");
|
|
51
|
+
var _indentationMarksTransform = require("./transforms/indentation-marks-transform");
|
|
52
|
+
|
|
53
|
+
var _invalidMediaContentTransform = require("./transforms/invalid-media-content-transform");
|
package/dist/cjs/version.json
CHANGED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { traverse } from '../traverse/traverse';
|
|
2
|
+
import { isEmpty } from './helpers';
|
|
3
|
+
|
|
4
|
+
const getChildrenTypeCounts = (nodeContent, allowedTypes) => {
|
|
5
|
+
let childrenTypes = {};
|
|
6
|
+
nodeContent.forEach((childNode, index) => {
|
|
7
|
+
if (!(childNode !== null && childNode !== void 0 && childNode.type) || !allowedTypes.includes(childNode.type)) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (!childrenTypes[childNode.type]) {
|
|
12
|
+
childrenTypes[childNode.type] = 1;
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
childrenTypes[childNode.type]++;
|
|
17
|
+
});
|
|
18
|
+
return childrenTypes;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const removeDuplicatedNodes = (type, content, predicate) => {
|
|
22
|
+
let maxIterations = 10;
|
|
23
|
+
let childrenTypeCounts = getChildrenTypeCounts(content, [type])[type];
|
|
24
|
+
let firstPredicateNodeIndex = content.findIndex(predicate);
|
|
25
|
+
|
|
26
|
+
while (childrenTypeCounts > 1 && firstPredicateNodeIndex > -1 && maxIterations-- > 0) {
|
|
27
|
+
content.splice(firstPredicateNodeIndex, 1);
|
|
28
|
+
firstPredicateNodeIndex = content.findIndex(predicate);
|
|
29
|
+
childrenTypeCounts = getChildrenTypeCounts(content, [type])[type];
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @param {{[type:string]:number}} allowedTypes - array types allowed to deduplicate
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
const deduplicateMediaSingleChildren = (node, allowedTypes) => {
|
|
38
|
+
if (!node.content) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const content = [...node.content];
|
|
43
|
+
Object.keys(allowedTypes).forEach(type => {
|
|
44
|
+
//prioritise removing empty nodes first
|
|
45
|
+
removeDuplicatedNodes(type, content, node => (node === null || node === void 0 ? void 0 : node.type) === type && isEmpty(node)); //remove other remaining dupicates
|
|
46
|
+
|
|
47
|
+
removeDuplicatedNodes(type, content, node => (node === null || node === void 0 ? void 0 : node.type) === type);
|
|
48
|
+
});
|
|
49
|
+
return { ...node,
|
|
50
|
+
content
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const transformInvalidMediaContent = adf => {
|
|
55
|
+
let isTransformed = false;
|
|
56
|
+
const transformedAdf = traverse(adf, {
|
|
57
|
+
mediaSingle: node => {
|
|
58
|
+
var _node$content;
|
|
59
|
+
|
|
60
|
+
if (!(node !== null && node !== void 0 && (_node$content = node.content) !== null && _node$content !== void 0 && _node$content.length)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const disallowedDuplicateTypes = ['media', 'caption'];
|
|
65
|
+
const childrenTypes = getChildrenTypeCounts(node.content, disallowedDuplicateTypes);
|
|
66
|
+
|
|
67
|
+
if (Object.values(childrenTypes).some(occurences => occurences > 1)) {
|
|
68
|
+
isTransformed = true;
|
|
69
|
+
return deduplicateMediaSingleChildren(node, childrenTypes);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
transformedAdf,
|
|
75
|
+
isTransformed
|
|
76
|
+
};
|
|
77
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { traverse } from '../traverse/traverse';
|
|
2
2
|
import { tableRow, tableCell, paragraph, listItem } from '../builders';
|
|
3
|
+
import { isEmpty } from './helpers';
|
|
3
4
|
|
|
4
5
|
const getMaxColumnsCountForTable = tableNode => {
|
|
5
6
|
var _tableNode$content;
|
|
@@ -25,12 +26,6 @@ const createValidEmptyContent = node => {
|
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
const isEmpty = node => {
|
|
29
|
-
var _node$content;
|
|
30
|
-
|
|
31
|
-
return ((_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.length) === 0;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
29
|
const fixIfTableCellInvalidEmpty = reportTransform => node => {
|
|
35
30
|
if (isEmpty(node)) {
|
|
36
31
|
reportTransform();
|
|
@@ -41,15 +36,15 @@ const fixIfTableCellInvalidEmpty = reportTransform => node => {
|
|
|
41
36
|
};
|
|
42
37
|
|
|
43
38
|
const hasNonListItemChildren = node => {
|
|
44
|
-
var _node$
|
|
39
|
+
var _node$content;
|
|
45
40
|
|
|
46
|
-
return (_node$
|
|
41
|
+
return (_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.some(node => (node === null || node === void 0 ? void 0 : node.type) !== 'listItem');
|
|
47
42
|
};
|
|
48
43
|
|
|
49
44
|
const hasEmptyListItemChildren = node => {
|
|
50
|
-
var _node$
|
|
45
|
+
var _node$content2;
|
|
51
46
|
|
|
52
|
-
return (_node$
|
|
47
|
+
return (_node$content2 = node.content) === null || _node$content2 === void 0 ? void 0 : _node$content2.some(childNode => {
|
|
53
48
|
var _childNode$content2;
|
|
54
49
|
|
|
55
50
|
return (childNode === null || childNode === void 0 ? void 0 : childNode.type) === 'listItem' && !((_childNode$content2 = childNode.content) !== null && _childNode$content2 !== void 0 && _childNode$content2.length);
|
|
@@ -94,9 +89,9 @@ const fixIfListParentWithInvalidListItemChildren = reportTransform => node => {
|
|
|
94
89
|
};
|
|
95
90
|
|
|
96
91
|
const hasNonTableRowChildren = node => {
|
|
97
|
-
var _node$
|
|
92
|
+
var _node$content3;
|
|
98
93
|
|
|
99
|
-
return (_node$
|
|
94
|
+
return (_node$content3 = node.content) === null || _node$content3 === void 0 ? void 0 : _node$content3.some(node => (node === null || node === void 0 ? void 0 : node.type) !== 'tableRow');
|
|
100
95
|
};
|
|
101
96
|
|
|
102
97
|
const tryCreateValidTableRowWrappedChildren = parentTableNode => {
|
|
@@ -135,12 +130,12 @@ const tryCreateValidTableRowWrappedChildren = parentTableNode => {
|
|
|
135
130
|
};
|
|
136
131
|
|
|
137
132
|
const hasEmptyTableRowChildren = node => {
|
|
138
|
-
var _node$
|
|
133
|
+
var _node$content4;
|
|
139
134
|
|
|
140
|
-
return node === null || node === void 0 ? void 0 : (_node$
|
|
141
|
-
var _node$
|
|
135
|
+
return node === null || node === void 0 ? void 0 : (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(node => {
|
|
136
|
+
var _node$content5;
|
|
142
137
|
|
|
143
|
-
return (node === null || node === void 0 ? void 0 : node.type) === 'tableRow' && (node === null || node === void 0 ? void 0 : (_node$
|
|
138
|
+
return (node === null || node === void 0 ? void 0 : node.type) === 'tableRow' && (node === null || node === void 0 ? void 0 : (_node$content5 = node.content) === null || _node$content5 === void 0 ? void 0 : _node$content5.length) === 0;
|
|
144
139
|
});
|
|
145
140
|
};
|
|
146
141
|
|
|
@@ -153,6 +148,13 @@ const fixIfTableParentWithInvalidTableRowChildren = reportTransform => node => {
|
|
|
153
148
|
}
|
|
154
149
|
};
|
|
155
150
|
|
|
151
|
+
const removeMediaSingleWithNoContent = reportTransform => node => {
|
|
152
|
+
if (isEmpty(node)) {
|
|
153
|
+
reportTransform();
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
156
158
|
export const transformNodesMissingContent = adf => {
|
|
157
159
|
let isTransformed = false;
|
|
158
160
|
|
|
@@ -166,7 +168,8 @@ export const transformNodesMissingContent = adf => {
|
|
|
166
168
|
transformedAdf = traverse(transformedAdf || adf, {
|
|
167
169
|
bulletList: fixIfListParentWithInvalidListItemChildren(reportTransform),
|
|
168
170
|
orderedList: fixIfListParentWithInvalidListItemChildren(reportTransform),
|
|
169
|
-
table: fixIfTableParentWithInvalidTableRowChildren(reportTransform)
|
|
171
|
+
table: fixIfTableParentWithInvalidTableRowChildren(reportTransform),
|
|
172
|
+
mediaSingle: removeMediaSingleWithNoContent(reportTransform)
|
|
170
173
|
});
|
|
171
174
|
return {
|
|
172
175
|
transformedAdf,
|
|
@@ -2,4 +2,5 @@ export { transformMediaLinkMarks } from './transforms/media-link-transform';
|
|
|
2
2
|
export { transformTextLinkCodeMarks } from './transforms/text-link-code-transform';
|
|
3
3
|
export { transformDedupeMarks } from './transforms/dedupe-marks-transform';
|
|
4
4
|
export { transformNodesMissingContent } from './transforms/nodes-missing-content-transform';
|
|
5
|
-
export { transformIndentationMarks } from './transforms/indentation-marks-transform';
|
|
5
|
+
export { transformIndentationMarks } from './transforms/indentation-marks-transform';
|
|
6
|
+
export { transformInvalidMediaContent } from './transforms/invalid-media-content-transform';
|
package/dist/es2019/version.json
CHANGED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
|
|
8
|
+
import { traverse } from '../traverse/traverse';
|
|
9
|
+
import { isEmpty } from './helpers';
|
|
10
|
+
|
|
11
|
+
var getChildrenTypeCounts = function getChildrenTypeCounts(nodeContent, allowedTypes) {
|
|
12
|
+
var childrenTypes = {};
|
|
13
|
+
nodeContent.forEach(function (childNode, index) {
|
|
14
|
+
if (!(childNode !== null && childNode !== void 0 && childNode.type) || !allowedTypes.includes(childNode.type)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!childrenTypes[childNode.type]) {
|
|
19
|
+
childrenTypes[childNode.type] = 1;
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
childrenTypes[childNode.type]++;
|
|
24
|
+
});
|
|
25
|
+
return childrenTypes;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var removeDuplicatedNodes = function removeDuplicatedNodes(type, content, predicate) {
|
|
29
|
+
var maxIterations = 10;
|
|
30
|
+
var childrenTypeCounts = getChildrenTypeCounts(content, [type])[type];
|
|
31
|
+
var firstPredicateNodeIndex = content.findIndex(predicate);
|
|
32
|
+
|
|
33
|
+
while (childrenTypeCounts > 1 && firstPredicateNodeIndex > -1 && maxIterations-- > 0) {
|
|
34
|
+
content.splice(firstPredicateNodeIndex, 1);
|
|
35
|
+
firstPredicateNodeIndex = content.findIndex(predicate);
|
|
36
|
+
childrenTypeCounts = getChildrenTypeCounts(content, [type])[type];
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @param {{[type:string]:number}} allowedTypes - array types allowed to deduplicate
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
var deduplicateMediaSingleChildren = function deduplicateMediaSingleChildren(node, allowedTypes) {
|
|
45
|
+
if (!node.content) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var content = _toConsumableArray(node.content);
|
|
50
|
+
|
|
51
|
+
Object.keys(allowedTypes).forEach(function (type) {
|
|
52
|
+
//prioritise removing empty nodes first
|
|
53
|
+
removeDuplicatedNodes(type, content, function (node) {
|
|
54
|
+
return (node === null || node === void 0 ? void 0 : node.type) === type && isEmpty(node);
|
|
55
|
+
}); //remove other remaining dupicates
|
|
56
|
+
|
|
57
|
+
removeDuplicatedNodes(type, content, function (node) {
|
|
58
|
+
return (node === null || node === void 0 ? void 0 : node.type) === type;
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
return _objectSpread(_objectSpread({}, node), {}, {
|
|
62
|
+
content: content
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export var transformInvalidMediaContent = function transformInvalidMediaContent(adf) {
|
|
67
|
+
var isTransformed = false;
|
|
68
|
+
var transformedAdf = traverse(adf, {
|
|
69
|
+
mediaSingle: function mediaSingle(node) {
|
|
70
|
+
var _node$content;
|
|
71
|
+
|
|
72
|
+
if (!(node !== null && node !== void 0 && (_node$content = node.content) !== null && _node$content !== void 0 && _node$content.length)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
var disallowedDuplicateTypes = ['media', 'caption'];
|
|
77
|
+
var childrenTypes = getChildrenTypeCounts(node.content, disallowedDuplicateTypes);
|
|
78
|
+
|
|
79
|
+
if (Object.values(childrenTypes).some(function (occurences) {
|
|
80
|
+
return occurences > 1;
|
|
81
|
+
})) {
|
|
82
|
+
isTransformed = true;
|
|
83
|
+
return deduplicateMediaSingleChildren(node, childrenTypes);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
transformedAdf: transformedAdf,
|
|
89
|
+
isTransformed: isTransformed
|
|
90
|
+
};
|
|
91
|
+
};
|
|
@@ -7,6 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
7
7
|
|
|
8
8
|
import { traverse } from '../traverse/traverse';
|
|
9
9
|
import { tableRow, tableCell, paragraph, listItem } from '../builders';
|
|
10
|
+
import { isEmpty } from './helpers';
|
|
10
11
|
|
|
11
12
|
var getMaxColumnsCountForTable = function getMaxColumnsCountForTable(tableNode) {
|
|
12
13
|
var _tableNode$content;
|
|
@@ -32,12 +33,6 @@ var createValidEmptyContent = function createValidEmptyContent(node) {
|
|
|
32
33
|
}
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
var isEmpty = function isEmpty(node) {
|
|
36
|
-
var _node$content;
|
|
37
|
-
|
|
38
|
-
return ((_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.length) === 0;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
36
|
var fixIfTableCellInvalidEmpty = function fixIfTableCellInvalidEmpty(reportTransform) {
|
|
42
37
|
return function (node) {
|
|
43
38
|
if (isEmpty(node)) {
|
|
@@ -50,17 +45,17 @@ var fixIfTableCellInvalidEmpty = function fixIfTableCellInvalidEmpty(reportTrans
|
|
|
50
45
|
};
|
|
51
46
|
|
|
52
47
|
var hasNonListItemChildren = function hasNonListItemChildren(node) {
|
|
53
|
-
var _node$
|
|
48
|
+
var _node$content;
|
|
54
49
|
|
|
55
|
-
return (_node$
|
|
50
|
+
return (_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.some(function (node) {
|
|
56
51
|
return (node === null || node === void 0 ? void 0 : node.type) !== 'listItem';
|
|
57
52
|
});
|
|
58
53
|
};
|
|
59
54
|
|
|
60
55
|
var hasEmptyListItemChildren = function hasEmptyListItemChildren(node) {
|
|
61
|
-
var _node$
|
|
56
|
+
var _node$content2;
|
|
62
57
|
|
|
63
|
-
return (_node$
|
|
58
|
+
return (_node$content2 = node.content) === null || _node$content2 === void 0 ? void 0 : _node$content2.some(function (childNode) {
|
|
64
59
|
var _childNode$content2;
|
|
65
60
|
|
|
66
61
|
return (childNode === null || childNode === void 0 ? void 0 : childNode.type) === 'listItem' && !((_childNode$content2 = childNode.content) !== null && _childNode$content2 !== void 0 && _childNode$content2.length);
|
|
@@ -107,9 +102,9 @@ var fixIfListParentWithInvalidListItemChildren = function fixIfListParentWithInv
|
|
|
107
102
|
};
|
|
108
103
|
|
|
109
104
|
var hasNonTableRowChildren = function hasNonTableRowChildren(node) {
|
|
110
|
-
var _node$
|
|
105
|
+
var _node$content3;
|
|
111
106
|
|
|
112
|
-
return (_node$
|
|
107
|
+
return (_node$content3 = node.content) === null || _node$content3 === void 0 ? void 0 : _node$content3.some(function (node) {
|
|
113
108
|
return (node === null || node === void 0 ? void 0 : node.type) !== 'tableRow';
|
|
114
109
|
});
|
|
115
110
|
};
|
|
@@ -150,12 +145,12 @@ var tryCreateValidTableRowWrappedChildren = function tryCreateValidTableRowWrapp
|
|
|
150
145
|
};
|
|
151
146
|
|
|
152
147
|
var hasEmptyTableRowChildren = function hasEmptyTableRowChildren(node) {
|
|
153
|
-
var _node$
|
|
148
|
+
var _node$content4;
|
|
154
149
|
|
|
155
|
-
return node === null || node === void 0 ? void 0 : (_node$
|
|
156
|
-
var _node$
|
|
150
|
+
return node === null || node === void 0 ? void 0 : (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
|
|
151
|
+
var _node$content5;
|
|
157
152
|
|
|
158
|
-
return (node === null || node === void 0 ? void 0 : node.type) === 'tableRow' && (node === null || node === void 0 ? void 0 : (_node$
|
|
153
|
+
return (node === null || node === void 0 ? void 0 : node.type) === 'tableRow' && (node === null || node === void 0 ? void 0 : (_node$content5 = node.content) === null || _node$content5 === void 0 ? void 0 : _node$content5.length) === 0;
|
|
159
154
|
});
|
|
160
155
|
};
|
|
161
156
|
|
|
@@ -170,6 +165,15 @@ var fixIfTableParentWithInvalidTableRowChildren = function fixIfTableParentWithI
|
|
|
170
165
|
};
|
|
171
166
|
};
|
|
172
167
|
|
|
168
|
+
var removeMediaSingleWithNoContent = function removeMediaSingleWithNoContent(reportTransform) {
|
|
169
|
+
return function (node) {
|
|
170
|
+
if (isEmpty(node)) {
|
|
171
|
+
reportTransform();
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
|
|
173
177
|
export var transformNodesMissingContent = function transformNodesMissingContent(adf) {
|
|
174
178
|
var isTransformed = false;
|
|
175
179
|
|
|
@@ -183,7 +187,8 @@ export var transformNodesMissingContent = function transformNodesMissingContent(
|
|
|
183
187
|
transformedAdf = traverse(transformedAdf || adf, {
|
|
184
188
|
bulletList: fixIfListParentWithInvalidListItemChildren(reportTransform),
|
|
185
189
|
orderedList: fixIfListParentWithInvalidListItemChildren(reportTransform),
|
|
186
|
-
table: fixIfTableParentWithInvalidTableRowChildren(reportTransform)
|
|
190
|
+
table: fixIfTableParentWithInvalidTableRowChildren(reportTransform),
|
|
191
|
+
mediaSingle: removeMediaSingleWithNoContent(reportTransform)
|
|
187
192
|
});
|
|
188
193
|
return {
|
|
189
194
|
transformedAdf: transformedAdf,
|
package/dist/esm/transforms.js
CHANGED
|
@@ -2,4 +2,5 @@ export { transformMediaLinkMarks } from './transforms/media-link-transform';
|
|
|
2
2
|
export { transformTextLinkCodeMarks } from './transforms/text-link-code-transform';
|
|
3
3
|
export { transformDedupeMarks } from './transforms/dedupe-marks-transform';
|
|
4
4
|
export { transformNodesMissingContent } from './transforms/nodes-missing-content-transform';
|
|
5
|
-
export { transformIndentationMarks } from './transforms/indentation-marks-transform';
|
|
5
|
+
export { transformIndentationMarks } from './transforms/indentation-marks-transform';
|
|
6
|
+
export { transformInvalidMediaContent } from './transforms/invalid-media-content-transform';
|
package/dist/esm/version.json
CHANGED
|
@@ -3,3 +3,4 @@ export { transformTextLinkCodeMarks } from './transforms/text-link-code-transfor
|
|
|
3
3
|
export { transformDedupeMarks } from './transforms/dedupe-marks-transform';
|
|
4
4
|
export { transformNodesMissingContent } from './transforms/nodes-missing-content-transform';
|
|
5
5
|
export { transformIndentationMarks } from './transforms/indentation-marks-transform';
|
|
6
|
+
export { transformInvalidMediaContent } from './transforms/invalid-media-content-transform';
|
package/empty-adf/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/empty-adf.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/empty-adf.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/empty-adf.d.ts"
|
|
7
|
+
"types": "../dist/types/empty-adf.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/empty-adf.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/adf-utils",
|
|
3
|
-
"version": "17.1.
|
|
3
|
+
"version": "17.1.5",
|
|
4
4
|
"description": "Set of utilities to traverse, modify and create ADF documents.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@atlaskit/docs": "*",
|
|
42
|
-
"@atlaskit/json-schema-generator": "^3.
|
|
42
|
+
"@atlaskit/json-schema-generator": "^3.3.0",
|
|
43
43
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
44
44
|
"jscodeshift": "^0.13.0",
|
|
45
45
|
"react": "^16.8.0",
|
|
46
|
-
"typescript": "4.
|
|
46
|
+
"typescript": "4.5.5",
|
|
47
47
|
"wait-for-expect": "^1.2.0"
|
|
48
48
|
},
|
|
49
49
|
"techstack": {
|
|
@@ -53,7 +53,10 @@
|
|
|
53
53
|
]
|
|
54
54
|
},
|
|
55
55
|
"@repo/internal": {
|
|
56
|
-
"deprecation": "no-deprecated-imports"
|
|
56
|
+
"deprecation": "no-deprecated-imports",
|
|
57
|
+
"styling": [
|
|
58
|
+
"emotion"
|
|
59
|
+
]
|
|
57
60
|
}
|
|
58
61
|
},
|
|
59
62
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
package/report.api.md
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
<!-- API Report Version: 2.2 -->
|
|
2
|
+
|
|
1
3
|
## API Report File for "@atlaskit/adf-utils"
|
|
2
4
|
|
|
3
|
-
> Do not edit this file.
|
|
5
|
+
> Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
|
|
6
|
+
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
|
+
|
|
8
|
+
### Table of contents
|
|
9
|
+
|
|
10
|
+
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
|
|
12
|
+
### Main Entry Types
|
|
13
|
+
|
|
14
|
+
<!--SECTION START: Main Entry Types-->
|
|
4
15
|
|
|
5
16
|
```ts
|
|
6
|
-
|
|
17
|
+
// (No @packageDocumentation comment for this package)
|
|
7
18
|
```
|
|
19
|
+
|
|
20
|
+
<!--SECTION END: Main Entry Types-->
|
package/scrub/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/scrub.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/scrub.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/scrub.d.ts"
|
|
7
|
+
"types": "../dist/types/scrub.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/scrub.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
package/transforms/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/transforms.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/transforms.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/transforms.d.ts"
|
|
7
|
+
"types": "../dist/types/transforms.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/transforms.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
package/traverse/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/traverse.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/traverse.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/traverse.d.ts"
|
|
7
|
+
"types": "../dist/types/traverse.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/traverse.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
package/types/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/types/index.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/types/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/types/index.d.ts"
|
|
7
|
+
"types": "../dist/types/types/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/types/index.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
package/validator/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/validator.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/validator.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/validator.d.ts"
|
|
7
|
+
"types": "../dist/types/validator.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/validator.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/types/validatorTypes.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/types/validatorTypes.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/types/validatorTypes.d.ts"
|
|
7
|
+
"types": "../dist/types/types/validatorTypes.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/types/validatorTypes.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|