@carbon/upgrade 11.34.0 → 11.35.0-rc.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/cli.js +2 -5
- package/package.json +2 -2
- package/transforms/__testfixtures__/ibm-products-update-pdlc-status.input.js +7 -2
- package/transforms/__testfixtures__/ibm-products-update-pdlc-status.output.js +3 -1
- package/transforms/ibm-products-update-pdlc-status.js +47 -38
- package/transforms/nonStableMapping.js +1 -0
- package/transforms/rename-imports-to-preview-core-and-products.js +28 -39
package/cli.js
CHANGED
|
@@ -34340,7 +34340,6 @@ var require_react_is_production = __commonJS({
|
|
|
34340
34340
|
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
34341
34341
|
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
|
34342
34342
|
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
34343
|
-
Symbol.for("react.provider");
|
|
34344
34343
|
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer");
|
|
34345
34344
|
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
|
34346
34345
|
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
|
@@ -34472,9 +34471,7 @@ var require_react_is_development = __commonJS({
|
|
|
34472
34471
|
}
|
|
34473
34472
|
}
|
|
34474
34473
|
}
|
|
34475
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
34476
|
-
Symbol.for("react.provider");
|
|
34477
|
-
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
|
|
34474
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
|
|
34478
34475
|
exports2.ContextConsumer = REACT_CONSUMER_TYPE;
|
|
34479
34476
|
exports2.ContextProvider = REACT_CONTEXT_TYPE;
|
|
34480
34477
|
exports2.Element = REACT_ELEMENT_TYPE;
|
|
@@ -44386,7 +44383,7 @@ var upgrades = [
|
|
|
44386
44383
|
var package_default = {
|
|
44387
44384
|
name: "@carbon/upgrade",
|
|
44388
44385
|
description: "A tool for upgrading Carbon versions",
|
|
44389
|
-
version: "11.
|
|
44386
|
+
version: "11.35.0-rc.0",
|
|
44390
44387
|
license: "Apache-2.0",
|
|
44391
44388
|
bin: {
|
|
44392
44389
|
"carbon-upgrade": "./bin/carbon-upgrade.js"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/upgrade",
|
|
3
3
|
"description": "A tool for upgrading Carbon versions",
|
|
4
|
-
"version": "11.
|
|
4
|
+
"version": "11.35.0-rc.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bin": {
|
|
7
7
|
"carbon-upgrade": "./bin/carbon-upgrade.js"
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"@ibm/telemetry-js": "^1.5.0",
|
|
61
61
|
"jscodeshift": "^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "dff507858b43de91b300a98fa1bec24d38aaeb48"
|
|
64
64
|
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
1
|
+
// prettier-ignore
|
|
2
|
+
// eslint-disable no-unused-vars
|
|
3
|
+
import {
|
|
4
|
+
Tearsheet,
|
|
5
|
+
InlineTip,
|
|
6
|
+
previewCandidate__SearchBar as SearchBar,
|
|
7
|
+
} from '@carbon/ibm-products';
|
|
@@ -30,54 +30,63 @@ function transformer(file, api) {
|
|
|
30
30
|
},
|
|
31
31
|
})
|
|
32
32
|
.forEach((path) => {
|
|
33
|
-
const
|
|
33
|
+
const seen = new Set();
|
|
34
34
|
const newSpecifiers = [];
|
|
35
|
+
|
|
35
36
|
path.node.specifiers.forEach((specifier) => {
|
|
36
37
|
if (specifier.type === 'ImportSpecifier') {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
const importedName = specifier.imported.name;
|
|
39
|
+
const localName = specifier.local
|
|
40
|
+
? specifier.local.name
|
|
41
|
+
: importedName;
|
|
42
|
+
|
|
43
|
+
const isAlreadyUpdated = nonStableComponentKeys.some(
|
|
44
|
+
(key) => importedName === productsPreviewMap[key]
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const needsUpdate = nonStableComponentKeys.includes(importedName);
|
|
48
|
+
|
|
49
|
+
if (isAlreadyUpdated) {
|
|
50
|
+
// Already has prefix, ensure it has an alias to the base component name
|
|
51
|
+
// Find the base component name by looking up which key maps to this prefixed name
|
|
52
|
+
const baseComponentName = nonStableComponentKeys.find(
|
|
53
|
+
(key) => productsPreviewMap[key] === importedName
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
if (baseComponentName && !seen.has(importedName)) {
|
|
57
|
+
seen.add(importedName);
|
|
51
58
|
const importSpecifier = j.importSpecifier(
|
|
52
|
-
j.identifier(
|
|
53
|
-
// Use the already specified alias if there is one
|
|
59
|
+
j.identifier(importedName),
|
|
54
60
|
j.identifier(localName)
|
|
55
61
|
);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
newSpecifiers.push(importSpecifier);
|
|
63
|
+
} else if (!seen.has(importedName)) {
|
|
64
|
+
seen.add(importedName);
|
|
65
|
+
newSpecifiers.push(specifier);
|
|
66
|
+
}
|
|
67
|
+
} else if (needsUpdate) {
|
|
68
|
+
const transformedImportedName = productsPreviewMap[importedName];
|
|
62
69
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
70
|
+
if (!seen.has(transformedImportedName)) {
|
|
71
|
+
seen.add(transformedImportedName);
|
|
72
|
+
const importSpecifier = j.importSpecifier(
|
|
73
|
+
j.identifier(transformedImportedName),
|
|
74
|
+
j.identifier(localName)
|
|
75
|
+
);
|
|
76
|
+
newSpecifiers.push(importSpecifier);
|
|
71
77
|
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
} else {
|
|
79
|
+
// Keep other imports unchanged
|
|
80
|
+
if (!seen.has(importedName)) {
|
|
81
|
+
seen.add(importedName);
|
|
82
|
+
newSpecifiers.push(specifier);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
newSpecifiers.push(specifier);
|
|
79
87
|
}
|
|
80
88
|
});
|
|
89
|
+
path.node.specifiers = newSpecifiers;
|
|
81
90
|
})
|
|
82
91
|
.toSource();
|
|
83
92
|
}
|
|
@@ -37,60 +37,49 @@ function transformer(file, api) {
|
|
|
37
37
|
},
|
|
38
38
|
})
|
|
39
39
|
.forEach((path) => {
|
|
40
|
-
const uniqueSpecifiers = new Set();
|
|
41
40
|
const newSpecifiers = [];
|
|
41
|
+
const seen = new Set();
|
|
42
|
+
|
|
42
43
|
path.node.specifiers.forEach((specifier) => {
|
|
43
44
|
if (specifier.type === 'ImportSpecifier') {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
const importedName = specifier.imported.name;
|
|
46
|
+
const localName = specifier.local
|
|
47
|
+
? specifier.local.name
|
|
48
|
+
: importedName;
|
|
49
|
+
|
|
50
|
+
if (nonStableKeys.includes(importedName)) {
|
|
51
|
+
const transformedImportedName = allPreviews[importedName];
|
|
52
|
+
|
|
53
|
+
if (!seen.has(importedName)) {
|
|
54
|
+
seen.add(importedName);
|
|
55
|
+
|
|
53
56
|
if (p === '@carbon/ibm-products') {
|
|
54
|
-
//
|
|
55
|
-
// products components changing exports
|
|
56
|
-
// are aliased to their original name.
|
|
57
|
-
// This will help to avoid additional changes
|
|
58
|
-
// within jsx.
|
|
57
|
+
// Create aliased import for products components
|
|
59
58
|
const importSpecifier = j.importSpecifier(
|
|
60
59
|
j.identifier(transformedImportedName),
|
|
61
|
-
// Use the already specified alias if there is one
|
|
62
60
|
j.identifier(localName)
|
|
63
61
|
);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
);
|
|
70
|
-
if (specifier.type === 'ImportSpecifier') {
|
|
71
|
-
if (!uniqueSpecifiers.has(importedName)) {
|
|
72
|
-
uniqueSpecifiers.add(importedName);
|
|
73
|
-
newSpecifiers.push(importSpecifier);
|
|
74
|
-
}
|
|
75
|
-
} else {
|
|
76
|
-
newSpecifiers.push(specifier);
|
|
77
|
-
}
|
|
62
|
+
newSpecifiers.push(importSpecifier);
|
|
63
|
+
} else {
|
|
64
|
+
// For @carbon/react, just update the name
|
|
65
|
+
specifier.imported.name = transformedImportedName;
|
|
66
|
+
newSpecifiers.push(specifier);
|
|
78
67
|
}
|
|
79
68
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (p === '@carbon/ibm-products') {
|
|
84
|
-
const others = path.node.specifiers.filter(
|
|
85
|
-
(c) =>
|
|
86
|
-
!Object.values(productsPreviewMap).includes(c.imported.name)
|
|
87
|
-
);
|
|
88
|
-
path.node.specifiers = [...others, ...newSpecifiers];
|
|
69
|
+
} else {
|
|
70
|
+
// Keep non-transformed imports as-is
|
|
71
|
+
newSpecifiers.push(specifier);
|
|
89
72
|
}
|
|
73
|
+
} else {
|
|
74
|
+
// Keep non-ImportSpecifier types (like ImportDefaultSpecifier)
|
|
75
|
+
newSpecifiers.push(specifier);
|
|
90
76
|
}
|
|
91
77
|
});
|
|
78
|
+
|
|
79
|
+
path.node.specifiers = newSpecifiers;
|
|
92
80
|
});
|
|
93
81
|
});
|
|
82
|
+
|
|
94
83
|
return root.toSource();
|
|
95
84
|
}
|
|
96
85
|
|