@atlaskit/adf-utils 19.13.1 → 19.14.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 +16 -0
- package/afm-cc/tsconfig.json +1 -5
- package/dist/cjs/transforms/errors.js +4 -0
- package/dist/cjs/validator/specs/index.js +16 -16
- package/dist/es2019/transforms/errors.js +4 -0
- package/dist/es2019/validator/specs/index.js +1 -1
- package/dist/esm/transforms/errors.js +4 -0
- package/dist/esm/validator/specs/index.js +1 -1
- package/dist/types/transforms/errors.d.ts +4 -0
- package/dist/types/validator/specs/index.d.ts +1 -1
- package/dist/types-ts4.5/transforms/errors.d.ts +4 -0
- package/dist/types-ts4.5/validator/specs/index.d.ts +1 -1
- package/package.json +2 -4
- package/codemods/17.0.0-update-imports-to-new-entry-points.ts +0 -166
- package/codemods/__tests__/next-update-imports-to-new-entry-points.ts +0 -175
- package/codemods/helpers/entry-points.ts +0 -25
- package/codemods/types/entry-points.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/adf-utils
|
|
2
2
|
|
|
3
|
+
## 19.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#169499](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/169499)
|
|
8
|
+
[`7d83c833bbcb1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7d83c833bbcb1) -
|
|
9
|
+
Remove v16->v17 codemod, and associated jscodeshift/codemod-utils dependencies.
|
|
10
|
+
|
|
11
|
+
## 19.13.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#165765](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165765)
|
|
16
|
+
[`3f441f30e6507`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3f441f30e6507) -
|
|
17
|
+
Bump adf-schema to 46.0.0
|
|
18
|
+
|
|
3
19
|
## 19.13.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -13,9 +13,13 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
13
13
|
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
14
14
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
15
15
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
16
|
+
/** NodeNestingTransformError */
|
|
16
17
|
var NodeNestingTransformError = exports.NodeNestingTransformError = /*#__PURE__*/function (_Error) {
|
|
17
18
|
(0, _inherits2.default)(NodeNestingTransformError, _Error);
|
|
18
19
|
var _super = _createSuper(NodeNestingTransformError);
|
|
20
|
+
/**
|
|
21
|
+
* @param message - Error message - Do not use any UGC in this message
|
|
22
|
+
*/
|
|
19
23
|
function NodeNestingTransformError(message) {
|
|
20
24
|
var _this;
|
|
21
25
|
(0, _classCallCheck2.default)(this, NodeNestingTransformError);
|
|
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "blockCard", {
|
|
|
27
27
|
return _schemaValidator.blockCard;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "blockRootOnly", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _schemaValidator.blockRootOnly;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
30
36
|
Object.defineProperty(exports, "block_content", {
|
|
31
37
|
enumerable: true,
|
|
32
38
|
get: function get() {
|
|
@@ -87,16 +93,10 @@ Object.defineProperty(exports, "codeBlock", {
|
|
|
87
93
|
return _schemaValidator.codeBlock;
|
|
88
94
|
}
|
|
89
95
|
});
|
|
90
|
-
Object.defineProperty(exports, "
|
|
91
|
-
enumerable: true,
|
|
92
|
-
get: function get() {
|
|
93
|
-
return _schemaValidator.codeBlock_with_marks;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
Object.defineProperty(exports, "codeBlock_with_no_marks", {
|
|
96
|
+
Object.defineProperty(exports, "codeBlock_root_only", {
|
|
97
97
|
enumerable: true,
|
|
98
98
|
get: function get() {
|
|
99
|
-
return _schemaValidator.
|
|
99
|
+
return _schemaValidator.codeBlock_root_only;
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
Object.defineProperty(exports, "confluenceInlineComment", {
|
|
@@ -159,16 +159,10 @@ Object.defineProperty(exports, "expand", {
|
|
|
159
159
|
return _schemaValidator.expand;
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
|
-
Object.defineProperty(exports, "
|
|
162
|
+
Object.defineProperty(exports, "expand_root_only", {
|
|
163
163
|
enumerable: true,
|
|
164
164
|
get: function get() {
|
|
165
|
-
return _schemaValidator.
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
Object.defineProperty(exports, "expand_with_no_mark", {
|
|
169
|
-
enumerable: true,
|
|
170
|
-
get: function get() {
|
|
171
|
-
return _schemaValidator.expand_with_no_mark;
|
|
165
|
+
return _schemaValidator.expand_root_only;
|
|
172
166
|
}
|
|
173
167
|
});
|
|
174
168
|
Object.defineProperty(exports, "extension", {
|
|
@@ -507,6 +501,12 @@ Object.defineProperty(exports, "text_link_inline", {
|
|
|
507
501
|
return _schemaValidator.text_link_inline;
|
|
508
502
|
}
|
|
509
503
|
});
|
|
504
|
+
Object.defineProperty(exports, "text_with_no_marks", {
|
|
505
|
+
enumerable: true,
|
|
506
|
+
get: function get() {
|
|
507
|
+
return _schemaValidator.text_with_no_marks;
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
510
|
Object.defineProperty(exports, "underline", {
|
|
511
511
|
enumerable: true,
|
|
512
512
|
get: function get() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
-
export { alignment, annotation, backgroundColor, blockCard, block_content, blockquote, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock,
|
|
2
|
+
export { alignment, annotation, backgroundColor, blockCard, block_content, blockRootOnly, blockquote, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock, codeBlock_root_only, text_with_no_marks, confluenceInlineComment, dataConsumer, date, decisionItem, decisionList, doc, em, embedCard, emoji, expand, expand_root_only, extension, extensionFrame, extension_with_marks, fragment, hardBreak, heading, heading_with_alignment, heading_with_indentation, heading_with_no_marks, indentation, inlineCard, inlineExtension, inlineExtension_with_marks, inline_content, layoutColumn, layoutSection, layoutSection_full, layoutSection_with_single_column, link, listItem, media, mediaGroup, mediaInline, mediaSingle, mediaSingle_caption, mediaSingle_full, mention, multiBodiedExtension, nestedExpand, nestedExpand_content, nestedExpand_with_no_marks, non_nestable_block_content, orderedList, panel, panel_with_nested_blockquote,
|
|
3
3
|
// Stage-0
|
|
4
4
|
paragraph, paragraph_with_alignment, paragraph_with_indentation, paragraph_with_no_marks, placeholder, rule, status, strike, strong, subsup, table, tableCell, tableHeader, tableRow, taskItem, taskList, text, textColor, text_code_inline, text_formatted, text_link_inline, underline } from '@atlaskit/adf-schema/schema-validator';
|
|
@@ -6,9 +6,13 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
6
6
|
import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
|
|
7
7
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
+
/** NodeNestingTransformError */
|
|
9
10
|
export var NodeNestingTransformError = /*#__PURE__*/function (_Error) {
|
|
10
11
|
_inherits(NodeNestingTransformError, _Error);
|
|
11
12
|
var _super = _createSuper(NodeNestingTransformError);
|
|
13
|
+
/**
|
|
14
|
+
* @param message - Error message - Do not use any UGC in this message
|
|
15
|
+
*/
|
|
12
16
|
function NodeNestingTransformError(message) {
|
|
13
17
|
var _this;
|
|
14
18
|
_classCallCheck(this, NodeNestingTransformError);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
-
export { alignment, annotation, backgroundColor, blockCard, block_content, blockquote, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock,
|
|
2
|
+
export { alignment, annotation, backgroundColor, blockCard, block_content, blockRootOnly, blockquote, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock, codeBlock_root_only, text_with_no_marks, confluenceInlineComment, dataConsumer, date, decisionItem, decisionList, doc, em, embedCard, emoji, expand, expand_root_only, extension, extensionFrame, extension_with_marks, fragment, hardBreak, heading, heading_with_alignment, heading_with_indentation, heading_with_no_marks, indentation, inlineCard, inlineExtension, inlineExtension_with_marks, inline_content, layoutColumn, layoutSection, layoutSection_full, layoutSection_with_single_column, link, listItem, media, mediaGroup, mediaInline, mediaSingle, mediaSingle_caption, mediaSingle_full, mention, multiBodiedExtension, nestedExpand, nestedExpand_content, nestedExpand_with_no_marks, non_nestable_block_content, orderedList, panel, panel_with_nested_blockquote,
|
|
3
3
|
// Stage-0
|
|
4
4
|
paragraph, paragraph_with_alignment, paragraph_with_indentation, paragraph_with_no_marks, placeholder, rule, status, strike, strong, subsup, table, tableCell, tableHeader, tableRow, taskItem, taskList, text, textColor, text_code_inline, text_formatted, text_link_inline, underline } from '@atlaskit/adf-schema/schema-validator';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { alignment, annotation, backgroundColor, blockCard, block_content, blockquote, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock,
|
|
1
|
+
export { alignment, annotation, backgroundColor, blockCard, block_content, blockRootOnly, blockquote, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock, codeBlock_root_only, text_with_no_marks, confluenceInlineComment, dataConsumer, date, decisionItem, decisionList, doc, em, embedCard, emoji, expand, expand_root_only, extension, extensionFrame, extension_with_marks, fragment, hardBreak, heading, heading_with_alignment, heading_with_indentation, heading_with_no_marks, indentation, inlineCard, inlineExtension, inlineExtension_with_marks, inline_content, layoutColumn, layoutSection, layoutSection_full, layoutSection_with_single_column, link, listItem, media, mediaGroup, mediaInline, mediaSingle, mediaSingle_caption, mediaSingle_full, mention, multiBodiedExtension, nestedExpand, nestedExpand_content, nestedExpand_with_no_marks, non_nestable_block_content, orderedList, panel, panel_with_nested_blockquote, // Stage-0
|
|
2
2
|
paragraph, paragraph_with_alignment, paragraph_with_indentation, paragraph_with_no_marks, placeholder, rule, status, strike, strong, subsup, table, tableCell, tableHeader, tableRow, taskItem, taskList, text, textColor, text_code_inline, text_formatted, text_link_inline, underline, } from '@atlaskit/adf-schema/schema-validator';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { alignment, annotation, backgroundColor, blockCard, block_content, blockquote, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock,
|
|
1
|
+
export { alignment, annotation, backgroundColor, blockCard, block_content, blockRootOnly, blockquote, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock, codeBlock_root_only, text_with_no_marks, confluenceInlineComment, dataConsumer, date, decisionItem, decisionList, doc, em, embedCard, emoji, expand, expand_root_only, extension, extensionFrame, extension_with_marks, fragment, hardBreak, heading, heading_with_alignment, heading_with_indentation, heading_with_no_marks, indentation, inlineCard, inlineExtension, inlineExtension_with_marks, inline_content, layoutColumn, layoutSection, layoutSection_full, layoutSection_with_single_column, link, listItem, media, mediaGroup, mediaInline, mediaSingle, mediaSingle_caption, mediaSingle_full, mention, multiBodiedExtension, nestedExpand, nestedExpand_content, nestedExpand_with_no_marks, non_nestable_block_content, orderedList, panel, panel_with_nested_blockquote, // Stage-0
|
|
2
2
|
paragraph, paragraph_with_alignment, paragraph_with_indentation, paragraph_with_no_marks, placeholder, rule, status, strike, strong, subsup, table, tableCell, tableHeader, tableRow, taskItem, taskList, text, textColor, text_code_inline, text_formatted, text_link_inline, underline, } from '@atlaskit/adf-schema/schema-validator';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/adf-utils",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.14.0",
|
|
4
4
|
"description": "Set of utilities to traverse, modify and create ADF documents.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,13 +36,11 @@
|
|
|
36
36
|
"./validatorTypes": "./src/types/validatorTypes.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@atlaskit/adf-schema": "^
|
|
40
|
-
"@atlaskit/codemod-utils": "^4.2.0",
|
|
39
|
+
"@atlaskit/adf-schema": "^46.1.0",
|
|
41
40
|
"@babel/runtime": "^7.0.0"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
43
|
"@atlassian/adf-schema-json": "^1.22.0",
|
|
45
|
-
"jscodeshift": "^0.13.0",
|
|
46
44
|
"react": "^16.8.0",
|
|
47
45
|
"typescript": "~5.4.2",
|
|
48
46
|
"wait-for-expect": "^1.2.0"
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { createTransformer } from '@atlaskit/codemod-utils';
|
|
2
|
-
import { createMigratesFromEntryPointChangeRequests } from './helpers/entry-points';
|
|
3
|
-
import type { EntryPointChangeRequest } from './types/entry-points';
|
|
4
|
-
|
|
5
|
-
const DEFAULT_ADF_UTILS_IMPORT = '@atlaskit/adf-utils';
|
|
6
|
-
|
|
7
|
-
const types: EntryPointChangeRequest = {
|
|
8
|
-
importSpecifiers: ['ADFEntity', 'ADFEntityMark', 'Visitor', 'VisitorCollection'],
|
|
9
|
-
oldEntryPointsToRemove: [DEFAULT_ADF_UTILS_IMPORT],
|
|
10
|
-
newEntryPoint: `${DEFAULT_ADF_UTILS_IMPORT}/types`,
|
|
11
|
-
shouldBeTypeImport: true,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const validatorTypes: EntryPointChangeRequest = {
|
|
15
|
-
importSpecifiers: [
|
|
16
|
-
'Content',
|
|
17
|
-
'ErrorCallback',
|
|
18
|
-
'Output',
|
|
19
|
-
'ValidationError',
|
|
20
|
-
'ValidationErrorMap',
|
|
21
|
-
'ValidationErrorType',
|
|
22
|
-
'ValidationMode',
|
|
23
|
-
'ValidationOptions',
|
|
24
|
-
'ErrorCallbackOptions',
|
|
25
|
-
'Validate',
|
|
26
|
-
'NodeValidationResult',
|
|
27
|
-
'ValidatorSpec',
|
|
28
|
-
'AttributesSpec',
|
|
29
|
-
'ValidatorContent',
|
|
30
|
-
'MarkValidationResult',
|
|
31
|
-
'SpecValidatorResult',
|
|
32
|
-
'Err',
|
|
33
|
-
],
|
|
34
|
-
oldEntryPointsToRemove: [DEFAULT_ADF_UTILS_IMPORT, `${DEFAULT_ADF_UTILS_IMPORT}/validator`],
|
|
35
|
-
newEntryPoint: `${DEFAULT_ADF_UTILS_IMPORT}/validatorTypes`,
|
|
36
|
-
shouldBeTypeImport: true,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const transforms: EntryPointChangeRequest = {
|
|
40
|
-
importSpecifiers: [
|
|
41
|
-
'transformMediaLinkMarks',
|
|
42
|
-
'transformTextLinkCodeMarks',
|
|
43
|
-
'transformDedupeMarks',
|
|
44
|
-
'transformNodesMissingContent',
|
|
45
|
-
'transformIndentationMarks',
|
|
46
|
-
],
|
|
47
|
-
oldEntryPointsToRemove: [DEFAULT_ADF_UTILS_IMPORT],
|
|
48
|
-
newEntryPoint: `${DEFAULT_ADF_UTILS_IMPORT}/transforms`,
|
|
49
|
-
shouldBeTypeImport: false,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const traverse: EntryPointChangeRequest = {
|
|
53
|
-
importSpecifiers: ['traverse', 'map', 'reduce', 'filter'],
|
|
54
|
-
oldEntryPointsToRemove: [DEFAULT_ADF_UTILS_IMPORT],
|
|
55
|
-
newEntryPoint: `${DEFAULT_ADF_UTILS_IMPORT}/traverse`,
|
|
56
|
-
shouldBeTypeImport: false,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const builders: EntryPointChangeRequest = {
|
|
60
|
-
importSpecifiers: [
|
|
61
|
-
'a',
|
|
62
|
-
'alignment',
|
|
63
|
-
'b',
|
|
64
|
-
'blockCard',
|
|
65
|
-
'blockQuote',
|
|
66
|
-
'bodiedExtension',
|
|
67
|
-
'br',
|
|
68
|
-
'breakout',
|
|
69
|
-
'bulletList',
|
|
70
|
-
'code',
|
|
71
|
-
'codeBlock',
|
|
72
|
-
'date',
|
|
73
|
-
'decisionItem',
|
|
74
|
-
'decisionList',
|
|
75
|
-
'doc',
|
|
76
|
-
'em',
|
|
77
|
-
'embedCard',
|
|
78
|
-
'emoji',
|
|
79
|
-
'expand',
|
|
80
|
-
'extension',
|
|
81
|
-
'hardBreak',
|
|
82
|
-
'heading',
|
|
83
|
-
'hr',
|
|
84
|
-
'indentation',
|
|
85
|
-
'inlineCard',
|
|
86
|
-
'inlineExtension',
|
|
87
|
-
'layoutColumn',
|
|
88
|
-
'layoutSection',
|
|
89
|
-
'li',
|
|
90
|
-
'link',
|
|
91
|
-
'listItem',
|
|
92
|
-
'media',
|
|
93
|
-
'mediaGroup',
|
|
94
|
-
'mediaSingle',
|
|
95
|
-
'mention',
|
|
96
|
-
'nestedExpand',
|
|
97
|
-
'ol',
|
|
98
|
-
'orderedList',
|
|
99
|
-
'p',
|
|
100
|
-
'panel',
|
|
101
|
-
'paragraph',
|
|
102
|
-
'placeholder',
|
|
103
|
-
'rule',
|
|
104
|
-
'status',
|
|
105
|
-
'strike',
|
|
106
|
-
'strong',
|
|
107
|
-
'subsup',
|
|
108
|
-
'table',
|
|
109
|
-
'tableCell',
|
|
110
|
-
'tableHeader',
|
|
111
|
-
'tableRow',
|
|
112
|
-
'taskItem',
|
|
113
|
-
'taskList',
|
|
114
|
-
'td',
|
|
115
|
-
'text',
|
|
116
|
-
'textColor',
|
|
117
|
-
'th',
|
|
118
|
-
'tr',
|
|
119
|
-
'u',
|
|
120
|
-
'ul',
|
|
121
|
-
'underline',
|
|
122
|
-
'dataConsumer',
|
|
123
|
-
],
|
|
124
|
-
oldEntryPointsToRemove: [DEFAULT_ADF_UTILS_IMPORT],
|
|
125
|
-
newEntryPoint: `${DEFAULT_ADF_UTILS_IMPORT}/builders`,
|
|
126
|
-
shouldBeTypeImport: false,
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const emptyAdf: EntryPointChangeRequest = {
|
|
130
|
-
importSpecifiers: ['getEmptyADF'],
|
|
131
|
-
oldEntryPointsToRemove: [DEFAULT_ADF_UTILS_IMPORT],
|
|
132
|
-
newEntryPoint: `${DEFAULT_ADF_UTILS_IMPORT}/empty-adf`,
|
|
133
|
-
shouldBeTypeImport: false,
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const validator: EntryPointChangeRequest = {
|
|
137
|
-
importSpecifiers: ['validator', 'validateAttrs'],
|
|
138
|
-
oldEntryPointsToRemove: [DEFAULT_ADF_UTILS_IMPORT],
|
|
139
|
-
newEntryPoint: `${DEFAULT_ADF_UTILS_IMPORT}/validator`,
|
|
140
|
-
shouldBeTypeImport: false,
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
const scrub: EntryPointChangeRequest = {
|
|
144
|
-
importSpecifiers: ['scrubAdf'],
|
|
145
|
-
oldEntryPointsToRemove: [DEFAULT_ADF_UTILS_IMPORT],
|
|
146
|
-
newEntryPoint: `${DEFAULT_ADF_UTILS_IMPORT}/scrub`,
|
|
147
|
-
shouldBeTypeImport: false,
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const entryPointChangeRequests: EntryPointChangeRequest[] = [
|
|
151
|
-
transforms,
|
|
152
|
-
validatorTypes,
|
|
153
|
-
types,
|
|
154
|
-
traverse,
|
|
155
|
-
builders,
|
|
156
|
-
validator,
|
|
157
|
-
emptyAdf,
|
|
158
|
-
scrub,
|
|
159
|
-
];
|
|
160
|
-
|
|
161
|
-
export const entryPointChangeMigrates =
|
|
162
|
-
createMigratesFromEntryPointChangeRequests(entryPointChangeRequests);
|
|
163
|
-
|
|
164
|
-
const transformer = createTransformer(entryPointChangeMigrates);
|
|
165
|
-
|
|
166
|
-
export default transformer;
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import transformer from '../17.0.0-update-imports-to-new-entry-points';
|
|
2
|
-
|
|
3
|
-
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
4
|
-
|
|
5
|
-
describe('updates adf-util imports to new child entry points', () => {
|
|
6
|
-
defineInlineTest(
|
|
7
|
-
{ default: transformer, parser: 'tsx' },
|
|
8
|
-
{},
|
|
9
|
-
`
|
|
10
|
-
import { traverse } from "@atlaskit/adf-utils";
|
|
11
|
-
import { ADFEntity, ADFEntityMark } from "@atlaskit/adf-utils";
|
|
12
|
-
import { validateAttrs, validator, ValidationErrorMap } from '@atlaskit/adf-utils';
|
|
13
|
-
import type { NodeValidationResult } from '@atlaskit/adf-utils';
|
|
14
|
-
import { type ValidationMode } from '@atlaskit/adf-utils';
|
|
15
|
-
|
|
16
|
-
export default () => (
|
|
17
|
-
<div>
|
|
18
|
-
hello
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
21
|
-
`,
|
|
22
|
-
`
|
|
23
|
-
import type { ValidationErrorMap, ValidationMode, NodeValidationResult } from "@atlaskit/adf-utils/validatorTypes";
|
|
24
|
-
import type { ADFEntity, ADFEntityMark } from "@atlaskit/adf-utils/types";
|
|
25
|
-
import { traverse } from "@atlaskit/adf-utils/traverse";
|
|
26
|
-
import { validator, validateAttrs } from "@atlaskit/adf-utils/validator";
|
|
27
|
-
|
|
28
|
-
export default () => (
|
|
29
|
-
<div>
|
|
30
|
-
hello
|
|
31
|
-
</div>
|
|
32
|
-
);
|
|
33
|
-
`,
|
|
34
|
-
'should handle migrating any combination of old entry points (including type imports and imports with type modifiers) to new child entry points',
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
defineInlineTest(
|
|
38
|
-
{ default: transformer, parser: 'tsx' },
|
|
39
|
-
{},
|
|
40
|
-
`
|
|
41
|
-
import { traverse, teamRocketAndMeowth, scrubAdf } from "@atlaskit/adf-utils";
|
|
42
|
-
import { Pokemon, ADFEntityMark, AshKetchum } from "@atlaskit/adf-utils";
|
|
43
|
-
import type { PsyDuck } from "@atlaskit/adf-utils/pokemon-types";
|
|
44
|
-
import Boogeyman from "@deep/the-mariana-trench";
|
|
45
|
-
|
|
46
|
-
export default () => (
|
|
47
|
-
<div>
|
|
48
|
-
hello
|
|
49
|
-
</div>
|
|
50
|
-
);
|
|
51
|
-
`,
|
|
52
|
-
`
|
|
53
|
-
import type { ADFEntityMark } from "@atlaskit/adf-utils/types";
|
|
54
|
-
import { traverse } from "@atlaskit/adf-utils/traverse";
|
|
55
|
-
import { scrubAdf } from "@atlaskit/adf-utils/scrub";
|
|
56
|
-
import { teamRocketAndMeowth } from "@atlaskit/adf-utils";
|
|
57
|
-
import { Pokemon, AshKetchum } from "@atlaskit/adf-utils";
|
|
58
|
-
import type { PsyDuck } from "@atlaskit/adf-utils/pokemon-types";
|
|
59
|
-
import Boogeyman from "@deep/the-mariana-trench";
|
|
60
|
-
|
|
61
|
-
export default () => (
|
|
62
|
-
<div>
|
|
63
|
-
hello
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
`,
|
|
67
|
-
'should leave unknown entry points or import specifiers untouched (and unmerged if initially unmerged)',
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
defineInlineTest(
|
|
71
|
-
{ default: transformer, parser: 'tsx' },
|
|
72
|
-
{},
|
|
73
|
-
`
|
|
74
|
-
import { VisitorCollection } from "@atlaskit/adf-utils/types";
|
|
75
|
-
import type { Visitor } from "@atlaskit/adf-utils";
|
|
76
|
-
|
|
77
|
-
export default () => (
|
|
78
|
-
<div>
|
|
79
|
-
hello
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
`,
|
|
83
|
-
`
|
|
84
|
-
import type { VisitorCollection, Visitor } from "@atlaskit/adf-utils/types";
|
|
85
|
-
|
|
86
|
-
export default () => (
|
|
87
|
-
<div>
|
|
88
|
-
hello
|
|
89
|
-
</div>
|
|
90
|
-
);
|
|
91
|
-
`,
|
|
92
|
-
'should handle migrating new child entry points with mismatched importKinds (e.g. non-type when should be type import)',
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
defineInlineTest(
|
|
96
|
-
{ default: transformer, parser: 'tsx' },
|
|
97
|
-
{},
|
|
98
|
-
`
|
|
99
|
-
import { scrubAdf, doc, p, link } from "@atlaskit/adf-utils";
|
|
100
|
-
import { blockCard, paragraph } from "@atlaskit/adf-utils/builders";
|
|
101
|
-
import { placeholder, transformDedupeMarks } from "@atlaskit/adf-utils";
|
|
102
|
-
import { VisitorCollection } from "@atlaskit/adf-utils/types";
|
|
103
|
-
import type { Visitor } from "@atlaskit/adf-utils";
|
|
104
|
-
import { getEmptyADF } from "@atlaskit/adf-utils";
|
|
105
|
-
|
|
106
|
-
export default () => (
|
|
107
|
-
<div>
|
|
108
|
-
hello
|
|
109
|
-
</div>
|
|
110
|
-
);
|
|
111
|
-
`,
|
|
112
|
-
`
|
|
113
|
-
import { transformDedupeMarks } from "@atlaskit/adf-utils/transforms";
|
|
114
|
-
import { getEmptyADF } from "@atlaskit/adf-utils/empty-adf";
|
|
115
|
-
import { scrubAdf } from "@atlaskit/adf-utils/scrub";
|
|
116
|
-
import { blockCard, paragraph, doc, link, p, placeholder } from "@atlaskit/adf-utils/builders";
|
|
117
|
-
import type { VisitorCollection, Visitor } from "@atlaskit/adf-utils/types";
|
|
118
|
-
|
|
119
|
-
export default () => (
|
|
120
|
-
<div>
|
|
121
|
-
hello
|
|
122
|
-
</div>
|
|
123
|
-
);
|
|
124
|
-
`,
|
|
125
|
-
'should handle migrating any combination of old and new entry points to new child entry points',
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
defineInlineTest(
|
|
129
|
-
{ default: transformer, parser: 'tsx' },
|
|
130
|
-
{},
|
|
131
|
-
`
|
|
132
|
-
const { scrubAdf } = require("@atlaskit/adf-utils");
|
|
133
|
-
import * as adfUtils from "@atlaskit/adf-utils";
|
|
134
|
-
|
|
135
|
-
export default () => {
|
|
136
|
-
if (shouldFetchModule) {
|
|
137
|
-
import("@atlaskit/adf-utils").then(module => ({
|
|
138
|
-
something: "else"
|
|
139
|
-
}));
|
|
140
|
-
import("@atlaskit/adf-utils/traverse").then(module => {
|
|
141
|
-
const traverse = module.traverse;
|
|
142
|
-
traverse();
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
return (
|
|
146
|
-
<div>
|
|
147
|
-
hello
|
|
148
|
-
</div>
|
|
149
|
-
)
|
|
150
|
-
}
|
|
151
|
-
`,
|
|
152
|
-
`
|
|
153
|
-
const { scrubAdf } = require("@atlaskit/adf-utils");
|
|
154
|
-
import * as adfUtils from "@atlaskit/adf-utils";
|
|
155
|
-
|
|
156
|
-
export default () => {
|
|
157
|
-
if (shouldFetchModule) {
|
|
158
|
-
import("@atlaskit/adf-utils").then(module => ({
|
|
159
|
-
something: "else"
|
|
160
|
-
}));
|
|
161
|
-
import("@atlaskit/adf-utils/traverse").then(module => {
|
|
162
|
-
const traverse = module.traverse;
|
|
163
|
-
traverse();
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
return (
|
|
167
|
-
<div>
|
|
168
|
-
hello
|
|
169
|
-
</div>
|
|
170
|
-
)
|
|
171
|
-
}
|
|
172
|
-
`,
|
|
173
|
-
'should skip migrating other import syntaxes (namespace imports, CJS, dyamic imports)',
|
|
174
|
-
);
|
|
175
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { changeImportEntryPoint } from '@atlaskit/codemod-utils';
|
|
2
|
-
import type { EntryPointChangeRequest, EntryPointChangeMigrates } from '../types/entry-points';
|
|
3
|
-
|
|
4
|
-
export const createMigratesFromEntryPointChangeRequests = (
|
|
5
|
-
changeRequests: EntryPointChangeRequest[],
|
|
6
|
-
) => {
|
|
7
|
-
const entryPointChangeMigrates: EntryPointChangeMigrates = [];
|
|
8
|
-
changeRequests.forEach(
|
|
9
|
-
({ importSpecifiers, oldEntryPointsToRemove, newEntryPoint, shouldBeTypeImport }) => {
|
|
10
|
-
oldEntryPointsToRemove.forEach((oldEntryPoint) => {
|
|
11
|
-
importSpecifiers.forEach((importSpecifier) => {
|
|
12
|
-
entryPointChangeMigrates.push(
|
|
13
|
-
changeImportEntryPoint(
|
|
14
|
-
oldEntryPoint,
|
|
15
|
-
importSpecifier,
|
|
16
|
-
newEntryPoint,
|
|
17
|
-
shouldBeTypeImport,
|
|
18
|
-
),
|
|
19
|
-
);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
);
|
|
24
|
-
return entryPointChangeMigrates;
|
|
25
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { changeImportEntryPoint } from '@atlaskit/codemod-utils';
|
|
2
|
-
|
|
3
|
-
export type EntryPointChangeRequest = {
|
|
4
|
-
importSpecifiers: string[];
|
|
5
|
-
oldEntryPointsToRemove: string[];
|
|
6
|
-
newEntryPoint: string;
|
|
7
|
-
shouldBeTypeImport: boolean;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export type EntryPointChange = ReturnType<typeof changeImportEntryPoint>;
|
|
11
|
-
|
|
12
|
-
export type EntryPointChangeMigrates = EntryPointChange[];
|