@atlaskit/codemod-cli 0.19.0 → 0.20.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/CHANGELOG.md +14 -0
- package/cli/package.json +1 -1
- package/dist/cjs/main.js +1 -1
- package/dist/cjs/presets/index.js +2 -1
- package/dist/cjs/presets/migrate-to-new-buttons/utils/generate-new-button-element.js +12 -0
- package/dist/cjs/presets/migrate-to-new-buttons/utils/import-types-from-new-entry-point.js +0 -1
- package/dist/cjs/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/auto-scroll.js +79 -0
- package/dist/cjs/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/element-adapter-types.js +27 -0
- package/dist/cjs/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/external-adapter.js +51 -0
- package/dist/cjs/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/move-to-react-drop-indicator.js +37 -0
- package/dist/cjs/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/pointer-outside-of-preview.js +40 -0
- package/dist/cjs/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/prevent-unhandled.js +40 -0
- package/dist/cjs/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/update-safe-imports.js +47 -0
- package/dist/cjs/presets/upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable.js +40 -0
- package/dist/cjs/types.js +1 -1
- package/dist/es2019/main.js +0 -1
- package/dist/es2019/presets/index.js +2 -1
- package/dist/es2019/presets/migrate-to-new-buttons/utils/generate-new-button-element.js +8 -0
- package/dist/es2019/presets/migrate-to-new-buttons/utils/import-types-from-new-entry-point.js +0 -1
- package/dist/es2019/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/auto-scroll.js +52 -0
- package/dist/es2019/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/element-adapter-types.js +17 -0
- package/dist/es2019/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/external-adapter.js +63 -0
- package/dist/es2019/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/move-to-react-drop-indicator.js +31 -0
- package/dist/es2019/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/pointer-outside-of-preview.js +28 -0
- package/dist/es2019/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/prevent-unhandled.js +28 -0
- package/dist/es2019/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/update-safe-imports.js +41 -0
- package/dist/es2019/presets/upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable.js +19 -0
- package/dist/esm/main.js +1 -1
- package/dist/esm/presets/index.js +2 -1
- package/dist/esm/presets/migrate-to-new-buttons/utils/generate-new-button-element.js +12 -0
- package/dist/esm/presets/migrate-to-new-buttons/utils/import-types-from-new-entry-point.js +0 -1
- package/dist/esm/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/auto-scroll.js +73 -0
- package/dist/esm/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/element-adapter-types.js +21 -0
- package/dist/esm/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/external-adapter.js +44 -0
- package/dist/esm/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/move-to-react-drop-indicator.js +31 -0
- package/dist/esm/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/pointer-outside-of-preview.js +34 -0
- package/dist/esm/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/prevent-unhandled.js +34 -0
- package/dist/esm/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/update-safe-imports.js +41 -0
- package/dist/esm/presets/upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable.js +33 -0
- package/dist/esm/types.js +1 -1
- package/dist/types/presets/index.d.ts +1 -0
- package/dist/types/presets/migrate-to-new-buttons/utils/generate-new-button-element.d.ts +1 -1
- package/dist/types/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/auto-scroll.d.ts +2 -0
- package/dist/types/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/element-adapter-types.d.ts +2 -0
- package/dist/types/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/external-adapter.d.ts +3 -0
- package/dist/types/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/move-to-react-drop-indicator.d.ts +2 -0
- package/dist/types/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/pointer-outside-of-preview.d.ts +2 -0
- package/dist/types/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/prevent-unhandled.d.ts +2 -0
- package/dist/types/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/update-safe-imports.d.ts +2 -0
- package/dist/types/presets/upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable.d.ts +2 -0
- package/dist/types-ts4.5/presets/index.d.ts +1 -0
- package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/generate-new-button-element.d.ts +1 -1
- package/dist/types-ts4.5/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/auto-scroll.d.ts +2 -0
- package/dist/types-ts4.5/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/element-adapter-types.d.ts +2 -0
- package/dist/types-ts4.5/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/external-adapter.d.ts +3 -0
- package/dist/types-ts4.5/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/move-to-react-drop-indicator.d.ts +2 -0
- package/dist/types-ts4.5/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/pointer-outside-of-preview.d.ts +2 -0
- package/dist/types-ts4.5/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/prevent-unhandled.d.ts +2 -0
- package/dist/types-ts4.5/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/update-safe-imports.d.ts +2 -0
- package/dist/types-ts4.5/presets/upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable.d.ts +2 -0
- package/filepath/package.json +1 -1
- package/main/package.json +1 -1
- package/package.json +5 -4
- package/sinceRef/package.json +1 -1
- package/transforms/package.json +1 -1
- package/types/package.json +1 -1
- package/utils/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const oldPackagePath = '@atlaskit/pragmatic-drag-and-drop-react-indicator';
|
|
2
|
+
const newPackagePath = '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator';
|
|
3
|
+
function isString(value) {
|
|
4
|
+
return typeof value === 'string';
|
|
5
|
+
}
|
|
6
|
+
function isOldPackagePath(value) {
|
|
7
|
+
return isString(value) && value.startsWith(oldPackagePath);
|
|
8
|
+
}
|
|
9
|
+
export function moveToReactDropIndicator(file, api) {
|
|
10
|
+
const j = api.jscodeshift;
|
|
11
|
+
const root = j(file.source);
|
|
12
|
+
const isUsingImport = root.find(j.ImportDeclaration).some(path => isOldPackagePath(path.node.source.value));
|
|
13
|
+
|
|
14
|
+
// Don't format the file if we are not changing anything
|
|
15
|
+
if (!isUsingImport) {
|
|
16
|
+
return file.source;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// replace imports
|
|
20
|
+
root.find(j.ImportDeclaration).forEach(path => {
|
|
21
|
+
const {
|
|
22
|
+
value
|
|
23
|
+
} = path.node.source;
|
|
24
|
+
if (isString(value) && isOldPackagePath(path.node.source.value)) {
|
|
25
|
+
path.node.source.value = value.replace(oldPackagePath, newPackagePath);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return root.toSource({
|
|
29
|
+
quote: 'single'
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const paths = {
|
|
2
|
+
current: '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer',
|
|
3
|
+
next: '@atlaskit/pragmatic-drag-and-drop/element/pointer-outside-of-preview'
|
|
4
|
+
};
|
|
5
|
+
export function shiftToPointerOutsideOfPreview(file, api) {
|
|
6
|
+
const j = api.jscodeshift;
|
|
7
|
+
const root = j(file.source);
|
|
8
|
+
const isUsingImport = root.find(j.ImportDeclaration).some(path => path.node.source.value === paths.current);
|
|
9
|
+
|
|
10
|
+
// don't change the file if we don't need to
|
|
11
|
+
if (!isUsingImport) {
|
|
12
|
+
return file.source;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// replace old import path with new import path
|
|
16
|
+
root.find(j.ImportDeclaration).filter(path => path.node.source.value === paths.current)
|
|
17
|
+
// replace import
|
|
18
|
+
.map(path => {
|
|
19
|
+
path.node.source.value = paths.next;
|
|
20
|
+
return path;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// replace old named import and usages with new one
|
|
24
|
+
root.find(j.Identifier).filter(path => path.value.name === 'offsetFromPointer').replaceWith(j.identifier('pointerOutsideOfPreview'));
|
|
25
|
+
return root.toSource({
|
|
26
|
+
quote: 'single'
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const paths = {
|
|
2
|
+
current: '@atlaskit/pragmatic-drag-and-drop/addon/cancel-unhandled',
|
|
3
|
+
next: '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled'
|
|
4
|
+
};
|
|
5
|
+
export function shiftToPreventUnhandled(file, api) {
|
|
6
|
+
const j = api.jscodeshift;
|
|
7
|
+
const root = j(file.source);
|
|
8
|
+
const isUsingImport = root.find(j.ImportDeclaration).some(path => path.node.source.value === paths.current);
|
|
9
|
+
|
|
10
|
+
// don't change the file if we don't need to
|
|
11
|
+
if (!isUsingImport) {
|
|
12
|
+
return file.source;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// replace old import path with new import path
|
|
16
|
+
root.find(j.ImportDeclaration).filter(path => path.node.source.value === paths.current)
|
|
17
|
+
// replace import
|
|
18
|
+
.map(path => {
|
|
19
|
+
path.node.source.value = paths.next;
|
|
20
|
+
return path;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// replace old named import and usages with new one
|
|
24
|
+
root.find(j.Identifier).filter(path => path.value.name === 'cancelUnhandled').replaceWith(j.identifier('preventUnhandled'));
|
|
25
|
+
return root.toSource({
|
|
26
|
+
quote: 'single'
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const importMap = {
|
|
2
|
+
// core package
|
|
3
|
+
'@atlaskit/pragmatic-drag-and-drop/adapter/element': '@atlaskit/pragmatic-drag-and-drop/element/adapter',
|
|
4
|
+
'@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview': '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview',
|
|
5
|
+
'@atlaskit/pragmatic-drag-and-drop/util/center-under-pointer': '@atlaskit/pragmatic-drag-and-drop/element/center-under-pointer',
|
|
6
|
+
'@atlaskit/pragmatic-drag-and-drop/util/preserve-offset-on-source': '@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source',
|
|
7
|
+
'@atlaskit/pragmatic-drag-and-drop/util/disable-native-drag-preview': '@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview',
|
|
8
|
+
'@atlaskit/pragmatic-drag-and-drop/util/scroll-just-enough-into-view': '@atlaskit/pragmatic-drag-and-drop/element/scroll-just-enough-into-view',
|
|
9
|
+
'@atlaskit/pragmatic-drag-and-drop/util/combine': '@atlaskit/pragmatic-drag-and-drop/combine',
|
|
10
|
+
'@atlaskit/pragmatic-drag-and-drop/util/once': '@atlaskit/pragmatic-drag-and-drop/once',
|
|
11
|
+
'@atlaskit/pragmatic-drag-and-drop/util/reorder': '@atlaskit/pragmatic-drag-and-drop/reorder',
|
|
12
|
+
// hitbox package
|
|
13
|
+
'@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge': '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge'
|
|
14
|
+
|
|
15
|
+
// Doing cancel-unhandled in it's own transformer as the name is changing too
|
|
16
|
+
// '@atlaskit/pragmatic-drag-and-drop/addon/cancel-unhandled':
|
|
17
|
+
// '@atlaskit/pragmatic-drag-and-drop/cancel-unhandled',
|
|
18
|
+
// We are doing the name update in another transform
|
|
19
|
+
// '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer':
|
|
20
|
+
// '@atlaskit/pragmatic-drag-and-drop/element/offset-from-pointer',
|
|
21
|
+
};
|
|
22
|
+
export function updateSafeImports(file, api) {
|
|
23
|
+
const j = api.jscodeshift;
|
|
24
|
+
const root = j(file.source);
|
|
25
|
+
|
|
26
|
+
// avoiding reformatting the file if we are not changing anything
|
|
27
|
+
let changed = false;
|
|
28
|
+
root.find(j.ImportDeclaration).forEach(path => {
|
|
29
|
+
const importPath = path.node.source.value;
|
|
30
|
+
if (typeof importPath === 'string' && importMap[importPath]) {
|
|
31
|
+
changed = true;
|
|
32
|
+
path.node.source.value = importMap[importPath];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
if (!changed) {
|
|
36
|
+
return file.source;
|
|
37
|
+
}
|
|
38
|
+
return root.toSource({
|
|
39
|
+
quote: 'single'
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { updateSafeImports } from './transformers/update-safe-imports';
|
|
2
|
+
import { moveFromFileAdapterToExternalAdapter } from './transformers/external-adapter';
|
|
3
|
+
import { moveToReactDropIndicator } from './transformers/move-to-react-drop-indicator';
|
|
4
|
+
import { updateAutoScroll } from './transformers/auto-scroll';
|
|
5
|
+
import { shiftToPointerOutsideOfPreview } from './transformers/pointer-outside-of-preview';
|
|
6
|
+
import { shiftToPreventUnhandled } from './transformers/prevent-unhandled';
|
|
7
|
+
import { shiftCanMonitorArgType } from './transformers/element-adapter-types';
|
|
8
|
+
const transformers = [updateSafeImports, moveFromFileAdapterToExternalAdapter, moveToReactDropIndicator, updateAutoScroll, shiftToPointerOutsideOfPreview, shiftToPreventUnhandled, shiftCanMonitorArgType];
|
|
9
|
+
export default function transformer(file, api) {
|
|
10
|
+
let source = file.source;
|
|
11
|
+
for (const fn of transformers) {
|
|
12
|
+
const updated = {
|
|
13
|
+
...file,
|
|
14
|
+
source
|
|
15
|
+
};
|
|
16
|
+
source = fn(updated, api);
|
|
17
|
+
}
|
|
18
|
+
return source;
|
|
19
|
+
}
|
package/dist/esm/main.js
CHANGED
|
@@ -298,7 +298,7 @@ function _main() {
|
|
|
298
298
|
case 4:
|
|
299
299
|
_yield$parseArgs = _context5.sent;
|
|
300
300
|
packages = _yield$parseArgs.packages;
|
|
301
|
-
_process$env$_PACKAGE = "0.
|
|
301
|
+
_process$env$_PACKAGE = "0.20.1", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
|
|
302
302
|
logger.log(chalk.bgBlue(chalk.black("\uD83D\uDCDA Atlassian-Frontend codemod library @ ".concat(_PACKAGE_VERSION_, " \uD83D\uDCDA"))));
|
|
303
303
|
if (packages && packages.length > 0) {
|
|
304
304
|
logger.log(chalk.gray("Searching for codemods for newer versions of the following packages: ".concat(packages.map(function (pkg) {
|
|
@@ -7,7 +7,8 @@ import path from 'path';
|
|
|
7
7
|
import './styled-to-emotion/styled-to-emotion';
|
|
8
8
|
import './theme-remove-deprecated-mixins/theme-remove-deprecated-mixins';
|
|
9
9
|
import './migrate-to-new-buttons/migrate-to-new-buttons';
|
|
10
|
-
|
|
10
|
+
import './upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable';
|
|
11
|
+
var presets = ['styled-to-emotion', 'theme-remove-deprecated-mixins', 'migrate-to-new-buttons', 'upgrade-pragmatic-drag-and-drop-to-stable'].map(function (preset) {
|
|
11
12
|
return path.join(__dirname, preset, "".concat(preset, ".@(ts|js|tsx)"));
|
|
12
13
|
});
|
|
13
14
|
export default presets;
|
|
@@ -68,6 +68,18 @@ export var generateNewElement = function generateNewElement(variant, element, j)
|
|
|
68
68
|
|
|
69
69
|
// rename iconBefore/iconAfter to icon
|
|
70
70
|
iconAttrs[0].name.name = 'icon';
|
|
71
|
+
var ariaLabelAttr = j(element.openingElement).find(j.JSXAttribute).filter(function (attribute) {
|
|
72
|
+
return attribute.node.name.name === 'aria-label';
|
|
73
|
+
});
|
|
74
|
+
if (ariaLabelAttr.length) {
|
|
75
|
+
var hasNoLabelProp = !(attributes !== null && attributes !== void 0 && attributes.find(function (attribute) {
|
|
76
|
+
return attribute.type === 'JSXAttribute' && attribute.name.name === 'label';
|
|
77
|
+
}));
|
|
78
|
+
if (hasNoLabelProp && attributes) {
|
|
79
|
+
attributes.push(j.jsxAttribute(j.jsxIdentifier('label'), ariaLabelAttr.get().node.value));
|
|
80
|
+
}
|
|
81
|
+
ariaLabelAttr.remove();
|
|
82
|
+
}
|
|
71
83
|
}
|
|
72
84
|
return j.jsxElement(
|
|
73
85
|
// self closing if it's an icon button or icon link button
|
package/dist/esm/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/auto-scroll.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
3
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
4
|
+
var scenarios = [{
|
|
5
|
+
existing: {
|
|
6
|
+
importPath: '@atlaskit/pragmatic-drag-and-drop-auto-scroll/file',
|
|
7
|
+
namedImport: 'autoScrollForFiles'
|
|
8
|
+
},
|
|
9
|
+
updated: {
|
|
10
|
+
importPath: '@atlaskit/pragmatic-drag-and-drop-auto-scroll/external',
|
|
11
|
+
namedImport: 'autoScrollForExternal'
|
|
12
|
+
}
|
|
13
|
+
}, {
|
|
14
|
+
existing: {
|
|
15
|
+
importPath: '@atlaskit/pragmatic-drag-and-drop-auto-scroll/unsafe-overflow/file',
|
|
16
|
+
namedImport: 'unsafeOverflowAutoScrollForFiles'
|
|
17
|
+
},
|
|
18
|
+
updated: {
|
|
19
|
+
importPath: '@atlaskit/pragmatic-drag-and-drop-auto-scroll/unsafe-overflow/external',
|
|
20
|
+
namedImport: 'unsafeOverflowAutoScrollForExternal'
|
|
21
|
+
}
|
|
22
|
+
}];
|
|
23
|
+
export function updateAutoScroll(file, api) {
|
|
24
|
+
var j = api.jscodeshift;
|
|
25
|
+
var root = j(file.source);
|
|
26
|
+
var changed = false;
|
|
27
|
+
var _iterator = _createForOfIteratorHelper(scenarios),
|
|
28
|
+
_step;
|
|
29
|
+
try {
|
|
30
|
+
var _loop = function _loop() {
|
|
31
|
+
var scenario = _step.value;
|
|
32
|
+
var isUsingImport = root.find(j.ImportDeclaration).some(function (path) {
|
|
33
|
+
return path.node.source.value === scenario.existing.importPath;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// move on to the next scenario
|
|
37
|
+
if (!isUsingImport) {
|
|
38
|
+
return 1; // continue
|
|
39
|
+
}
|
|
40
|
+
changed = true;
|
|
41
|
+
|
|
42
|
+
// replace old import path with new import path
|
|
43
|
+
root.find(j.ImportDeclaration).filter(function (path) {
|
|
44
|
+
return path.node.source.value === scenario.existing.importPath;
|
|
45
|
+
})
|
|
46
|
+
// replace import
|
|
47
|
+
.map(function (path) {
|
|
48
|
+
path.node.source.value = scenario.updated.importPath;
|
|
49
|
+
return path;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// replace old named import and usages with new one
|
|
53
|
+
root.find(j.Identifier).filter(function (path) {
|
|
54
|
+
return path.value.name === scenario.existing.namedImport;
|
|
55
|
+
}).replaceWith(j.identifier(scenario.updated.namedImport));
|
|
56
|
+
};
|
|
57
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
58
|
+
if (_loop()) continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Don't format the file if we are not changing anything
|
|
62
|
+
} catch (err) {
|
|
63
|
+
_iterator.e(err);
|
|
64
|
+
} finally {
|
|
65
|
+
_iterator.f();
|
|
66
|
+
}
|
|
67
|
+
if (!changed) {
|
|
68
|
+
return file.source;
|
|
69
|
+
}
|
|
70
|
+
return root.toSource({
|
|
71
|
+
quote: 'single'
|
|
72
|
+
});
|
|
73
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var newImport = '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
2
|
+
export function shiftCanMonitorArgType(file, api) {
|
|
3
|
+
var j = api.jscodeshift;
|
|
4
|
+
var root = j(file.source);
|
|
5
|
+
var isUsingImport = root.find(j.ImportDeclaration).some(function (path) {
|
|
6
|
+
return path.node.source.value === newImport;
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// don't change the file if we don't need to
|
|
10
|
+
if (!isUsingImport) {
|
|
11
|
+
return file.source;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// replace old named import and usages with new one
|
|
15
|
+
root.find(j.Identifier).filter(function (path) {
|
|
16
|
+
return path.value.name === 'ElementMonitorCanMonitorArgs';
|
|
17
|
+
}).replaceWith(j.identifier('ElementMonitorGetFeedbackArgs'));
|
|
18
|
+
return root.toSource({
|
|
19
|
+
quote: 'single'
|
|
20
|
+
});
|
|
21
|
+
}
|
package/dist/esm/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/external-adapter.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { addCommentToStartOfFile } from '@atlaskit/codemod-utils';
|
|
2
|
+
export var pleaseMigrateMessage = "\n The file adapter has been replaced by a new (more powerful) external adapter.\n Please see our external adapter documentation on how to migrate your file adapter usage.\n\n We have also included \"containsFiles()\" as an import in this file as it is helpful to\n restrict your monitors and drop targets to only be for files.\n\n We have also included \"getFiles()\" as an import as it is a helpful way to extract the files\n from a drag operation\n\n dropTargetForExternal({\n canDrop: containsFiles,\n onDrop({source}) {\n const files = getFiles({source});\n }\n });\n\n monitorForExternal({\n canMonitor: containsFiles,\n onDrop({source}) {\n const files = getFiles({source});\n }\n });\n\n - [1.0 upgrade documentation](https://atlassian.design/components/pragmatic-drag-and-drop/core-package/changelog)\n - [external adapter documentation](https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/external)\n - [file usage documentation](https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/external/files)\n";
|
|
3
|
+
var oldImportPath = '@atlaskit/pragmatic-drag-and-drop/adapter/file';
|
|
4
|
+
var newImportPath = '@atlaskit/pragmatic-drag-and-drop/external/adapter';
|
|
5
|
+
export function moveFromFileAdapterToExternalAdapter(file, api) {
|
|
6
|
+
var j = api.jscodeshift;
|
|
7
|
+
var root = j(file.source);
|
|
8
|
+
var isUsingFileAdapter = root.find(j.ImportDeclaration).some(function (path) {
|
|
9
|
+
return path.node.source.value === oldImportPath;
|
|
10
|
+
});
|
|
11
|
+
if (!isUsingFileAdapter) {
|
|
12
|
+
return file.source;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// replace old import path with new import path
|
|
16
|
+
root.find(j.ImportDeclaration).filter(function (path) {
|
|
17
|
+
return path.node.source.value === oldImportPath;
|
|
18
|
+
})
|
|
19
|
+
// replace import
|
|
20
|
+
.map(function (path) {
|
|
21
|
+
path.node.source.value = newImportPath;
|
|
22
|
+
return path;
|
|
23
|
+
})
|
|
24
|
+
// Add an import for 'containsFiles()' and `getFiles()` as likely this file will need it
|
|
25
|
+
.insertAfter(j.importDeclaration([j.importSpecifier(j.identifier('containsFiles')), j.importSpecifier(j.identifier('getFiles'))], j.literal('@atlaskit/pragmatic-drag-and-drop/external/file')));
|
|
26
|
+
|
|
27
|
+
// update usages of `monitorForFiles` and `dropTargetForFiles`
|
|
28
|
+
root.find(j.Identifier).filter(function (path) {
|
|
29
|
+
return path.value.name === 'monitorForFiles';
|
|
30
|
+
}).replaceWith(j.identifier('monitorForExternal'));
|
|
31
|
+
root.find(j.Identifier).filter(function (path) {
|
|
32
|
+
return path.value.name === 'dropTargetForFiles';
|
|
33
|
+
}).replaceWith(j.identifier('dropTargetForExternal'));
|
|
34
|
+
|
|
35
|
+
// add comment to the start of the file
|
|
36
|
+
addCommentToStartOfFile({
|
|
37
|
+
j: j,
|
|
38
|
+
base: root,
|
|
39
|
+
message: pleaseMigrateMessage
|
|
40
|
+
});
|
|
41
|
+
return root.toSource({
|
|
42
|
+
quote: 'single'
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var oldPackagePath = '@atlaskit/pragmatic-drag-and-drop-react-indicator';
|
|
2
|
+
var newPackagePath = '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator';
|
|
3
|
+
function isString(value) {
|
|
4
|
+
return typeof value === 'string';
|
|
5
|
+
}
|
|
6
|
+
function isOldPackagePath(value) {
|
|
7
|
+
return isString(value) && value.startsWith(oldPackagePath);
|
|
8
|
+
}
|
|
9
|
+
export function moveToReactDropIndicator(file, api) {
|
|
10
|
+
var j = api.jscodeshift;
|
|
11
|
+
var root = j(file.source);
|
|
12
|
+
var isUsingImport = root.find(j.ImportDeclaration).some(function (path) {
|
|
13
|
+
return isOldPackagePath(path.node.source.value);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// Don't format the file if we are not changing anything
|
|
17
|
+
if (!isUsingImport) {
|
|
18
|
+
return file.source;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// replace imports
|
|
22
|
+
root.find(j.ImportDeclaration).forEach(function (path) {
|
|
23
|
+
var value = path.node.source.value;
|
|
24
|
+
if (isString(value) && isOldPackagePath(path.node.source.value)) {
|
|
25
|
+
path.node.source.value = value.replace(oldPackagePath, newPackagePath);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return root.toSource({
|
|
29
|
+
quote: 'single'
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var paths = {
|
|
2
|
+
current: '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer',
|
|
3
|
+
next: '@atlaskit/pragmatic-drag-and-drop/element/pointer-outside-of-preview'
|
|
4
|
+
};
|
|
5
|
+
export function shiftToPointerOutsideOfPreview(file, api) {
|
|
6
|
+
var j = api.jscodeshift;
|
|
7
|
+
var root = j(file.source);
|
|
8
|
+
var isUsingImport = root.find(j.ImportDeclaration).some(function (path) {
|
|
9
|
+
return path.node.source.value === paths.current;
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
// don't change the file if we don't need to
|
|
13
|
+
if (!isUsingImport) {
|
|
14
|
+
return file.source;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// replace old import path with new import path
|
|
18
|
+
root.find(j.ImportDeclaration).filter(function (path) {
|
|
19
|
+
return path.node.source.value === paths.current;
|
|
20
|
+
})
|
|
21
|
+
// replace import
|
|
22
|
+
.map(function (path) {
|
|
23
|
+
path.node.source.value = paths.next;
|
|
24
|
+
return path;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// replace old named import and usages with new one
|
|
28
|
+
root.find(j.Identifier).filter(function (path) {
|
|
29
|
+
return path.value.name === 'offsetFromPointer';
|
|
30
|
+
}).replaceWith(j.identifier('pointerOutsideOfPreview'));
|
|
31
|
+
return root.toSource({
|
|
32
|
+
quote: 'single'
|
|
33
|
+
});
|
|
34
|
+
}
|
package/dist/esm/presets/upgrade-pragmatic-drag-and-drop-to-stable/transformers/prevent-unhandled.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var paths = {
|
|
2
|
+
current: '@atlaskit/pragmatic-drag-and-drop/addon/cancel-unhandled',
|
|
3
|
+
next: '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled'
|
|
4
|
+
};
|
|
5
|
+
export function shiftToPreventUnhandled(file, api) {
|
|
6
|
+
var j = api.jscodeshift;
|
|
7
|
+
var root = j(file.source);
|
|
8
|
+
var isUsingImport = root.find(j.ImportDeclaration).some(function (path) {
|
|
9
|
+
return path.node.source.value === paths.current;
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
// don't change the file if we don't need to
|
|
13
|
+
if (!isUsingImport) {
|
|
14
|
+
return file.source;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// replace old import path with new import path
|
|
18
|
+
root.find(j.ImportDeclaration).filter(function (path) {
|
|
19
|
+
return path.node.source.value === paths.current;
|
|
20
|
+
})
|
|
21
|
+
// replace import
|
|
22
|
+
.map(function (path) {
|
|
23
|
+
path.node.source.value = paths.next;
|
|
24
|
+
return path;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// replace old named import and usages with new one
|
|
28
|
+
root.find(j.Identifier).filter(function (path) {
|
|
29
|
+
return path.value.name === 'cancelUnhandled';
|
|
30
|
+
}).replaceWith(j.identifier('preventUnhandled'));
|
|
31
|
+
return root.toSource({
|
|
32
|
+
quote: 'single'
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var importMap = {
|
|
2
|
+
// core package
|
|
3
|
+
'@atlaskit/pragmatic-drag-and-drop/adapter/element': '@atlaskit/pragmatic-drag-and-drop/element/adapter',
|
|
4
|
+
'@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview': '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview',
|
|
5
|
+
'@atlaskit/pragmatic-drag-and-drop/util/center-under-pointer': '@atlaskit/pragmatic-drag-and-drop/element/center-under-pointer',
|
|
6
|
+
'@atlaskit/pragmatic-drag-and-drop/util/preserve-offset-on-source': '@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source',
|
|
7
|
+
'@atlaskit/pragmatic-drag-and-drop/util/disable-native-drag-preview': '@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview',
|
|
8
|
+
'@atlaskit/pragmatic-drag-and-drop/util/scroll-just-enough-into-view': '@atlaskit/pragmatic-drag-and-drop/element/scroll-just-enough-into-view',
|
|
9
|
+
'@atlaskit/pragmatic-drag-and-drop/util/combine': '@atlaskit/pragmatic-drag-and-drop/combine',
|
|
10
|
+
'@atlaskit/pragmatic-drag-and-drop/util/once': '@atlaskit/pragmatic-drag-and-drop/once',
|
|
11
|
+
'@atlaskit/pragmatic-drag-and-drop/util/reorder': '@atlaskit/pragmatic-drag-and-drop/reorder',
|
|
12
|
+
// hitbox package
|
|
13
|
+
'@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge': '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge'
|
|
14
|
+
|
|
15
|
+
// Doing cancel-unhandled in it's own transformer as the name is changing too
|
|
16
|
+
// '@atlaskit/pragmatic-drag-and-drop/addon/cancel-unhandled':
|
|
17
|
+
// '@atlaskit/pragmatic-drag-and-drop/cancel-unhandled',
|
|
18
|
+
// We are doing the name update in another transform
|
|
19
|
+
// '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer':
|
|
20
|
+
// '@atlaskit/pragmatic-drag-and-drop/element/offset-from-pointer',
|
|
21
|
+
};
|
|
22
|
+
export function updateSafeImports(file, api) {
|
|
23
|
+
var j = api.jscodeshift;
|
|
24
|
+
var root = j(file.source);
|
|
25
|
+
|
|
26
|
+
// avoiding reformatting the file if we are not changing anything
|
|
27
|
+
var changed = false;
|
|
28
|
+
root.find(j.ImportDeclaration).forEach(function (path) {
|
|
29
|
+
var importPath = path.node.source.value;
|
|
30
|
+
if (typeof importPath === 'string' && importMap[importPath]) {
|
|
31
|
+
changed = true;
|
|
32
|
+
path.node.source.value = importMap[importPath];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
if (!changed) {
|
|
36
|
+
return file.source;
|
|
37
|
+
}
|
|
38
|
+
return root.toSource({
|
|
39
|
+
quote: 'single'
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
import { updateSafeImports } from './transformers/update-safe-imports';
|
|
8
|
+
import { moveFromFileAdapterToExternalAdapter } from './transformers/external-adapter';
|
|
9
|
+
import { moveToReactDropIndicator } from './transformers/move-to-react-drop-indicator';
|
|
10
|
+
import { updateAutoScroll } from './transformers/auto-scroll';
|
|
11
|
+
import { shiftToPointerOutsideOfPreview } from './transformers/pointer-outside-of-preview';
|
|
12
|
+
import { shiftToPreventUnhandled } from './transformers/prevent-unhandled';
|
|
13
|
+
import { shiftCanMonitorArgType } from './transformers/element-adapter-types';
|
|
14
|
+
var transformers = [updateSafeImports, moveFromFileAdapterToExternalAdapter, moveToReactDropIndicator, updateAutoScroll, shiftToPointerOutsideOfPreview, shiftToPreventUnhandled, shiftCanMonitorArgType];
|
|
15
|
+
export default function transformer(file, api) {
|
|
16
|
+
var source = file.source;
|
|
17
|
+
var _iterator = _createForOfIteratorHelper(transformers),
|
|
18
|
+
_step;
|
|
19
|
+
try {
|
|
20
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
21
|
+
var fn = _step.value;
|
|
22
|
+
var updated = _objectSpread(_objectSpread({}, file), {}, {
|
|
23
|
+
source: source
|
|
24
|
+
});
|
|
25
|
+
source = fn(updated, api);
|
|
26
|
+
}
|
|
27
|
+
} catch (err) {
|
|
28
|
+
_iterator.e(err);
|
|
29
|
+
} finally {
|
|
30
|
+
_iterator.f();
|
|
31
|
+
}
|
|
32
|
+
return source;
|
|
33
|
+
}
|
package/dist/esm/types.js
CHANGED
|
@@ -5,7 +5,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
6
|
import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
|
|
7
7
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
function _isNativeReflectConstruct() {
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
9
|
/** Converts required args to optional if they have a default
|
|
10
10
|
* Example: export type UserFlags = Default<Flags, keyof typeof defaultFlags>;
|
|
11
11
|
*/
|
|
@@ -5,5 +5,6 @@
|
|
|
5
5
|
import './styled-to-emotion/styled-to-emotion';
|
|
6
6
|
import './theme-remove-deprecated-mixins/theme-remove-deprecated-mixins';
|
|
7
7
|
import './migrate-to-new-buttons/migrate-to-new-buttons';
|
|
8
|
+
import './upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable';
|
|
8
9
|
declare const presets: string[];
|
|
9
10
|
export default presets;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { API, JSXElement, JSXAttribute, JSXSpreadAttribute } from 'jscodeshift';
|
|
2
2
|
import { NEW_BUTTON_VARIANTS } from '../utils/constants';
|
|
3
3
|
export declare const getIconAttributes: (attributes: (JSXAttribute | JSXSpreadAttribute)[]) => JSXAttribute[] | null;
|
|
4
4
|
export declare const getIconElement: (iconAttr: JSXAttribute) => JSXElement | null;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { API, FileInfo } from 'jscodeshift';
|
|
2
|
+
export declare const pleaseMigrateMessage = "\n The file adapter has been replaced by a new (more powerful) external adapter.\n Please see our external adapter documentation on how to migrate your file adapter usage.\n\n We have also included \"containsFiles()\" as an import in this file as it is helpful to\n restrict your monitors and drop targets to only be for files.\n\n We have also included \"getFiles()\" as an import as it is a helpful way to extract the files\n from a drag operation\n\n dropTargetForExternal({\n canDrop: containsFiles,\n onDrop({source}) {\n const files = getFiles({source});\n }\n });\n\n monitorForExternal({\n canMonitor: containsFiles,\n onDrop({source}) {\n const files = getFiles({source});\n }\n });\n\n - [1.0 upgrade documentation](https://atlassian.design/components/pragmatic-drag-and-drop/core-package/changelog)\n - [external adapter documentation](https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/external)\n - [file usage documentation](https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/external/files)\n";
|
|
3
|
+
export declare function moveFromFileAdapterToExternalAdapter(file: FileInfo, api: API): string;
|
|
@@ -5,5 +5,6 @@
|
|
|
5
5
|
import './styled-to-emotion/styled-to-emotion';
|
|
6
6
|
import './theme-remove-deprecated-mixins/theme-remove-deprecated-mixins';
|
|
7
7
|
import './migrate-to-new-buttons/migrate-to-new-buttons';
|
|
8
|
+
import './upgrade-pragmatic-drag-and-drop-to-stable/upgrade-pragmatic-drag-and-drop-to-stable';
|
|
8
9
|
declare const presets: string[];
|
|
9
10
|
export default presets;
|
package/dist/types-ts4.5/presets/migrate-to-new-buttons/utils/generate-new-button-element.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { API, JSXElement, JSXAttribute, JSXSpreadAttribute } from 'jscodeshift';
|
|
2
2
|
import { NEW_BUTTON_VARIANTS } from '../utils/constants';
|
|
3
3
|
export declare const getIconAttributes: (attributes: (JSXAttribute | JSXSpreadAttribute)[]) => JSXAttribute[] | null;
|
|
4
4
|
export declare const getIconElement: (iconAttr: JSXAttribute) => JSXElement | null;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { API, FileInfo } from 'jscodeshift';
|
|
2
|
+
export declare const pleaseMigrateMessage = "\n The file adapter has been replaced by a new (more powerful) external adapter.\n Please see our external adapter documentation on how to migrate your file adapter usage.\n\n We have also included \"containsFiles()\" as an import in this file as it is helpful to\n restrict your monitors and drop targets to only be for files.\n\n We have also included \"getFiles()\" as an import as it is a helpful way to extract the files\n from a drag operation\n\n dropTargetForExternal({\n canDrop: containsFiles,\n onDrop({source}) {\n const files = getFiles({source});\n }\n });\n\n monitorForExternal({\n canMonitor: containsFiles,\n onDrop({source}) {\n const files = getFiles({source});\n }\n });\n\n - [1.0 upgrade documentation](https://atlassian.design/components/pragmatic-drag-and-drop/core-package/changelog)\n - [external adapter documentation](https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/external)\n - [file usage documentation](https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/external/files)\n";
|
|
3
|
+
export declare function moveFromFileAdapterToExternalAdapter(file: FileInfo, api: API): string;
|