@carbon/upgrade 11.38.0 → 11.39.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/README.md +2 -0
- package/cli.js +183 -93
- package/package.json +2 -2
- package/transforms/__testfixtures__/ibm-products-update-page-header.input.js +17 -0
- package/transforms/__testfixtures__/ibm-products-update-page-header.output.js +13 -0
- package/transforms/__testfixtures__/ibm-products-update-page-header2.input.js +6 -0
- package/transforms/__testfixtures__/ibm-products-update-page-header2.output.js +6 -0
- package/transforms/__testfixtures__/ibm-products-update-page-header3.input.js +3 -0
- package/transforms/__testfixtures__/ibm-products-update-page-header3.output.js +3 -0
- package/transforms/__testfixtures__/ibm-products-update-page-header4.input.js +18 -0
- package/transforms/__testfixtures__/ibm-products-update-page-header4.output.js +18 -0
- package/transforms/__tests__/ibm-products-update-page-header-test.js +30 -0
- package/transforms/ibm-products-update-page-header.js +233 -0
package/README.md
CHANGED
|
@@ -48,6 +48,8 @@ Options:
|
|
|
48
48
|
[boolean] [default: false]
|
|
49
49
|
-v, --verbose optionally include additional logs, useful for debugging
|
|
50
50
|
[boolean] [default: false]
|
|
51
|
+
--decoratorsBeforeExport parse decorators before export declarations
|
|
52
|
+
[boolean] [default: false]
|
|
51
53
|
```
|
|
52
54
|
|
|
53
55
|
### Migrations
|
package/cli.js
CHANGED
|
@@ -1672,6 +1672,22 @@ var require_execa = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1672
1672
|
};
|
|
1673
1673
|
}));
|
|
1674
1674
|
//#endregion
|
|
1675
|
+
//#region ../../node_modules/concat-map/index.js
|
|
1676
|
+
var require_concat_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1677
|
+
module.exports = function(xs, fn) {
|
|
1678
|
+
var res = [];
|
|
1679
|
+
for (var i = 0; i < xs.length; i++) {
|
|
1680
|
+
var x = fn(xs[i], i);
|
|
1681
|
+
if (isArray(x)) res.push.apply(res, x);
|
|
1682
|
+
else res.push(x);
|
|
1683
|
+
}
|
|
1684
|
+
return res;
|
|
1685
|
+
};
|
|
1686
|
+
var isArray = Array.isArray || function(xs) {
|
|
1687
|
+
return Object.prototype.toString.call(xs) === "[object Array]";
|
|
1688
|
+
};
|
|
1689
|
+
}));
|
|
1690
|
+
//#endregion
|
|
1675
1691
|
//#region ../../node_modules/balanced-match/index.js
|
|
1676
1692
|
var require_balanced_match = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1677
1693
|
module.exports = balanced;
|
|
@@ -1721,8 +1737,9 @@ var require_balanced_match = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
1721
1737
|
}
|
|
1722
1738
|
}));
|
|
1723
1739
|
//#endregion
|
|
1724
|
-
//#region ../../node_modules/brace-expansion/index.js
|
|
1740
|
+
//#region ../../node_modules/minimatch/node_modules/brace-expansion/index.js
|
|
1725
1741
|
var require_brace_expansion = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1742
|
+
var concatMap = require_concat_map();
|
|
1726
1743
|
var balanced = require_balanced_match();
|
|
1727
1744
|
module.exports = expandTop;
|
|
1728
1745
|
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
@@ -1757,10 +1774,12 @@ var require_brace_expansion = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
1757
1774
|
parts.push.apply(parts, p);
|
|
1758
1775
|
return parts;
|
|
1759
1776
|
}
|
|
1760
|
-
function expandTop(str) {
|
|
1777
|
+
function expandTop(str, options) {
|
|
1761
1778
|
if (!str) return [];
|
|
1779
|
+
options = options || {};
|
|
1780
|
+
var max = options.max == null ? Infinity : options.max;
|
|
1762
1781
|
if (str.substr(0, 2) === "{}") str = "\\{\\}" + str.substr(2);
|
|
1763
|
-
return expand(escapeBraces(str), true).map(unescapeBraces);
|
|
1782
|
+
return expand(escapeBraces(str), max, true).map(unescapeBraces);
|
|
1764
1783
|
}
|
|
1765
1784
|
function embrace(str) {
|
|
1766
1785
|
return "{" + str + "}";
|
|
@@ -1774,78 +1793,74 @@ var require_brace_expansion = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
1774
1793
|
function gte(i, y) {
|
|
1775
1794
|
return i >= y;
|
|
1776
1795
|
}
|
|
1777
|
-
function expand(str, isTop) {
|
|
1796
|
+
function expand(str, max, isTop) {
|
|
1778
1797
|
var expansions = [];
|
|
1779
1798
|
var m = balanced("{", "}", str);
|
|
1780
|
-
if (!m) return [str];
|
|
1781
|
-
var
|
|
1782
|
-
var
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1799
|
+
if (!m || /\$$/.test(m.pre)) return [str];
|
|
1800
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
1801
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
1802
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
1803
|
+
var isOptions = m.body.indexOf(",") >= 0;
|
|
1804
|
+
if (!isSequence && !isOptions) {
|
|
1805
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
1806
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
1807
|
+
return expand(str, max, true);
|
|
1808
|
+
}
|
|
1809
|
+
return [str];
|
|
1810
|
+
}
|
|
1811
|
+
var n;
|
|
1812
|
+
if (isSequence) n = m.body.split(/\.\./);
|
|
1787
1813
|
else {
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
var isOptions = m.body.indexOf(",") >= 0;
|
|
1792
|
-
if (!isSequence && !isOptions) {
|
|
1793
|
-
if (m.post.match(/,(?!,).*\}/)) {
|
|
1794
|
-
str = m.pre + "{" + m.body + escClose + m.post;
|
|
1795
|
-
return expand(str);
|
|
1796
|
-
}
|
|
1797
|
-
return [str];
|
|
1798
|
-
}
|
|
1799
|
-
var n;
|
|
1800
|
-
if (isSequence) n = m.body.split(/\.\./);
|
|
1801
|
-
else {
|
|
1802
|
-
n = parseCommaParts(m.body);
|
|
1814
|
+
n = parseCommaParts(m.body);
|
|
1815
|
+
if (n.length === 1) {
|
|
1816
|
+
n = expand(n[0], max, false).map(embrace);
|
|
1803
1817
|
if (n.length === 1) {
|
|
1804
|
-
|
|
1805
|
-
|
|
1818
|
+
var post = m.post.length ? expand(m.post, max, false) : [""];
|
|
1819
|
+
return post.map(function(p) {
|
|
1806
1820
|
return m.pre + n[0] + p;
|
|
1807
1821
|
});
|
|
1808
1822
|
}
|
|
1809
1823
|
}
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1824
|
+
}
|
|
1825
|
+
var pre = m.pre;
|
|
1826
|
+
var post = m.post.length ? expand(m.post, max, false) : [""];
|
|
1827
|
+
var N;
|
|
1828
|
+
if (isSequence) {
|
|
1829
|
+
var x = numeric(n[0]);
|
|
1830
|
+
var y = numeric(n[1]);
|
|
1831
|
+
var width = Math.max(n[0].length, n[1].length);
|
|
1832
|
+
var incr = n.length == 3 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
|
1833
|
+
var test = lte;
|
|
1834
|
+
if (y < x) {
|
|
1835
|
+
incr *= -1;
|
|
1836
|
+
test = gte;
|
|
1837
|
+
}
|
|
1838
|
+
var pad = n.some(isPadded);
|
|
1839
|
+
N = [];
|
|
1840
|
+
for (var i = x; test(i, y); i += incr) {
|
|
1841
|
+
var c;
|
|
1842
|
+
if (isAlphaSequence) {
|
|
1843
|
+
c = String.fromCharCode(i);
|
|
1844
|
+
if (c === "\\") c = "";
|
|
1845
|
+
} else {
|
|
1846
|
+
c = String(i);
|
|
1847
|
+
if (pad) {
|
|
1848
|
+
var need = width - c.length;
|
|
1849
|
+
if (need > 0) {
|
|
1850
|
+
var z = new Array(need + 1).join("0");
|
|
1851
|
+
if (i < 0) c = "-" + z + c.slice(1);
|
|
1852
|
+
else c = z + c;
|
|
1837
1853
|
}
|
|
1838
1854
|
}
|
|
1839
|
-
N.push(c);
|
|
1840
1855
|
}
|
|
1841
|
-
|
|
1842
|
-
N = [];
|
|
1843
|
-
for (var j = 0; j < n.length; j++) N.push.apply(N, expand(n[j], false));
|
|
1844
|
-
}
|
|
1845
|
-
for (var j = 0; j < N.length; j++) for (var k = 0; k < post.length; k++) {
|
|
1846
|
-
var expansion = pre + N[j] + post[k];
|
|
1847
|
-
if (!isTop || isSequence || expansion) expansions.push(expansion);
|
|
1856
|
+
N.push(c);
|
|
1848
1857
|
}
|
|
1858
|
+
} else N = concatMap(n, function(el) {
|
|
1859
|
+
return expand(el, max, false);
|
|
1860
|
+
});
|
|
1861
|
+
for (var j = 0; j < N.length; j++) for (var k = 0; k < post.length && expansions.length < max; k++) {
|
|
1862
|
+
var expansion = pre + N[j] + post[k];
|
|
1863
|
+
if (!isTop || isSequence || expansion) expansions.push(expansion);
|
|
1849
1864
|
}
|
|
1850
1865
|
return expansions;
|
|
1851
1866
|
}
|
|
@@ -3204,7 +3219,7 @@ var require_cli_width = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3204
3219
|
}
|
|
3205
3220
|
}));
|
|
3206
3221
|
//#endregion
|
|
3207
|
-
//#region ../../node_modules/ansi-regex/index.js
|
|
3222
|
+
//#region ../../node_modules/strip-ansi/node_modules/ansi-regex/index.js
|
|
3208
3223
|
var require_ansi_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3209
3224
|
module.exports = ({ onlyFirst = false } = {}) => {
|
|
3210
3225
|
const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
|
|
@@ -30688,6 +30703,39 @@ var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
30688
30703
|
module.exports = coerce;
|
|
30689
30704
|
}));
|
|
30690
30705
|
//#endregion
|
|
30706
|
+
//#region ../../node_modules/semver/functions/truncate.js
|
|
30707
|
+
var require_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30708
|
+
const parse = require_parse$2();
|
|
30709
|
+
const constants = require_constants$3();
|
|
30710
|
+
const SemVer = require_semver$1();
|
|
30711
|
+
const truncate = (version, truncation, options) => {
|
|
30712
|
+
if (!constants.RELEASE_TYPES.includes(truncation)) return null;
|
|
30713
|
+
const clonedVersion = cloneInputVersion(version, options);
|
|
30714
|
+
return clonedVersion && doTruncation(clonedVersion, truncation);
|
|
30715
|
+
};
|
|
30716
|
+
const cloneInputVersion = (version, options) => {
|
|
30717
|
+
return parse(version instanceof SemVer ? version.version : version, options);
|
|
30718
|
+
};
|
|
30719
|
+
const doTruncation = (version, truncation) => {
|
|
30720
|
+
if (isPrerelease(truncation)) return version.version;
|
|
30721
|
+
version.prerelease = [];
|
|
30722
|
+
switch (truncation) {
|
|
30723
|
+
case "major":
|
|
30724
|
+
version.minor = 0;
|
|
30725
|
+
version.patch = 0;
|
|
30726
|
+
break;
|
|
30727
|
+
case "minor":
|
|
30728
|
+
version.patch = 0;
|
|
30729
|
+
break;
|
|
30730
|
+
}
|
|
30731
|
+
return version.format();
|
|
30732
|
+
};
|
|
30733
|
+
const isPrerelease = (type) => {
|
|
30734
|
+
return type.startsWith("pre");
|
|
30735
|
+
};
|
|
30736
|
+
module.exports = truncate;
|
|
30737
|
+
}));
|
|
30738
|
+
//#endregion
|
|
30691
30739
|
//#region ../../node_modules/semver/internal/lrucache.js
|
|
30692
30740
|
var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
30693
30741
|
var LRUCache = class {
|
|
@@ -31422,6 +31470,7 @@ var import_semver = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exp
|
|
|
31422
31470
|
lte: require_lte(),
|
|
31423
31471
|
cmp: require_cmp(),
|
|
31424
31472
|
coerce: require_coerce(),
|
|
31473
|
+
truncate: require_truncate(),
|
|
31425
31474
|
Comparator: require_comparator(),
|
|
31426
31475
|
Range: require_range(),
|
|
31427
31476
|
satisfies: require_satisfies(),
|
|
@@ -43742,8 +43791,9 @@ async function getSelectedWorkspace(workspaces) {
|
|
|
43742
43791
|
* LICENSE file in the root directory of this source tree.
|
|
43743
43792
|
*/
|
|
43744
43793
|
async function run$1(options) {
|
|
43745
|
-
const { dry, parser = "babylon", paths, print = dry, transform, verbose } = options;
|
|
43794
|
+
const { dry, parser = "babylon", decoratorsBeforeExport = false, paths, print = dry, transform, verbose, ...transformOptions } = options;
|
|
43746
43795
|
await jscodeshift_src_Runner_js.run(transform, paths, {
|
|
43796
|
+
...transformOptions,
|
|
43747
43797
|
dry,
|
|
43748
43798
|
parser,
|
|
43749
43799
|
parserConfig: {
|
|
@@ -43769,7 +43819,7 @@ async function run$1(options) {
|
|
|
43769
43819
|
"dynamicImport",
|
|
43770
43820
|
"nullishCoalescingOperator",
|
|
43771
43821
|
"optionalChaining",
|
|
43772
|
-
["decorators", { decoratorsBeforeExport
|
|
43822
|
+
["decorators", { decoratorsBeforeExport }]
|
|
43773
43823
|
]
|
|
43774
43824
|
},
|
|
43775
43825
|
print,
|
|
@@ -43801,6 +43851,12 @@ async function run$1(options) {
|
|
|
43801
43851
|
* LICENSE file in the root directory of this source tree.
|
|
43802
43852
|
*/
|
|
43803
43853
|
const TRANSFORM_DIR = path.default.join(__dirname, "transforms");
|
|
43854
|
+
async function runCodemod(options, config) {
|
|
43855
|
+
await run$1({
|
|
43856
|
+
...config,
|
|
43857
|
+
decoratorsBeforeExport: options.decoratorsBeforeExport
|
|
43858
|
+
});
|
|
43859
|
+
}
|
|
43804
43860
|
/**
|
|
43805
43861
|
* @typedef Upgrade
|
|
43806
43862
|
* @property {string} name
|
|
@@ -43922,7 +43978,7 @@ const upgrades = [
|
|
|
43922
43978
|
"**/storybook-static/**"
|
|
43923
43979
|
]
|
|
43924
43980
|
});
|
|
43925
|
-
await
|
|
43981
|
+
await runCodemod(options, {
|
|
43926
43982
|
dry: !options.write,
|
|
43927
43983
|
transform,
|
|
43928
43984
|
paths,
|
|
@@ -43945,7 +44001,7 @@ const upgrades = [
|
|
|
43945
44001
|
"**/storybook-static/**"
|
|
43946
44002
|
]
|
|
43947
44003
|
});
|
|
43948
|
-
await
|
|
44004
|
+
await runCodemod(options, {
|
|
43949
44005
|
dry: !options.write,
|
|
43950
44006
|
transform,
|
|
43951
44007
|
paths,
|
|
@@ -43968,7 +44024,7 @@ const upgrades = [
|
|
|
43968
44024
|
"**/storybook-static/**"
|
|
43969
44025
|
]
|
|
43970
44026
|
});
|
|
43971
|
-
await
|
|
44027
|
+
await runCodemod(options, {
|
|
43972
44028
|
dry: !options.write,
|
|
43973
44029
|
transform,
|
|
43974
44030
|
paths,
|
|
@@ -43991,7 +44047,7 @@ const upgrades = [
|
|
|
43991
44047
|
"**/storybook-static/**"
|
|
43992
44048
|
]
|
|
43993
44049
|
});
|
|
43994
|
-
await
|
|
44050
|
+
await runCodemod(options, {
|
|
43995
44051
|
dry: !options.write,
|
|
43996
44052
|
transform,
|
|
43997
44053
|
paths,
|
|
@@ -44014,7 +44070,7 @@ const upgrades = [
|
|
|
44014
44070
|
"**/storybook-static/**"
|
|
44015
44071
|
]
|
|
44016
44072
|
});
|
|
44017
|
-
await
|
|
44073
|
+
await runCodemod(options, {
|
|
44018
44074
|
dry: !options.write,
|
|
44019
44075
|
transform,
|
|
44020
44076
|
paths,
|
|
@@ -44051,7 +44107,7 @@ const upgrades = [
|
|
|
44051
44107
|
"**/storybook-static/**"
|
|
44052
44108
|
]
|
|
44053
44109
|
});
|
|
44054
|
-
await
|
|
44110
|
+
await runCodemod(options, {
|
|
44055
44111
|
dry: !options.write,
|
|
44056
44112
|
transform,
|
|
44057
44113
|
paths,
|
|
@@ -44085,7 +44141,7 @@ const upgrades = [
|
|
|
44085
44141
|
"**/storybook-static/**"
|
|
44086
44142
|
]
|
|
44087
44143
|
});
|
|
44088
|
-
await
|
|
44144
|
+
await runCodemod(options, {
|
|
44089
44145
|
dry: !options.write,
|
|
44090
44146
|
transform,
|
|
44091
44147
|
paths,
|
|
@@ -44130,7 +44186,7 @@ const upgrades = [
|
|
|
44130
44186
|
"**/coverage/**"
|
|
44131
44187
|
]
|
|
44132
44188
|
});
|
|
44133
|
-
await
|
|
44189
|
+
await runCodemod(options, {
|
|
44134
44190
|
dry: !options.write,
|
|
44135
44191
|
transform,
|
|
44136
44192
|
paths,
|
|
@@ -44165,7 +44221,7 @@ const upgrades = [
|
|
|
44165
44221
|
"**/storybook-static/**"
|
|
44166
44222
|
]
|
|
44167
44223
|
});
|
|
44168
|
-
await
|
|
44224
|
+
await runCodemod(options, {
|
|
44169
44225
|
dry: !options.write,
|
|
44170
44226
|
transform,
|
|
44171
44227
|
paths,
|
|
@@ -44221,7 +44277,7 @@ const upgrades = [
|
|
|
44221
44277
|
"**/coverage/**"
|
|
44222
44278
|
]
|
|
44223
44279
|
});
|
|
44224
|
-
await
|
|
44280
|
+
await runCodemod(options, {
|
|
44225
44281
|
dry: !options.write,
|
|
44226
44282
|
transform,
|
|
44227
44283
|
paths,
|
|
@@ -44250,7 +44306,7 @@ const upgrades = [
|
|
|
44250
44306
|
"**/storybook-static/**"
|
|
44251
44307
|
]
|
|
44252
44308
|
});
|
|
44253
|
-
await
|
|
44309
|
+
await runCodemod(options, {
|
|
44254
44310
|
dry: !options.write,
|
|
44255
44311
|
transform,
|
|
44256
44312
|
paths,
|
|
@@ -44305,7 +44361,7 @@ const upgrades = [
|
|
|
44305
44361
|
"**/coverage/**"
|
|
44306
44362
|
]
|
|
44307
44363
|
});
|
|
44308
|
-
await
|
|
44364
|
+
await runCodemod(options, {
|
|
44309
44365
|
dry: !options.write,
|
|
44310
44366
|
transform,
|
|
44311
44367
|
paths,
|
|
@@ -44334,7 +44390,7 @@ const upgrades = [
|
|
|
44334
44390
|
"**/storybook-static/**"
|
|
44335
44391
|
]
|
|
44336
44392
|
});
|
|
44337
|
-
await
|
|
44393
|
+
await runCodemod(options, {
|
|
44338
44394
|
dry: !options.write,
|
|
44339
44395
|
transform,
|
|
44340
44396
|
paths,
|
|
@@ -44342,6 +44398,35 @@ const upgrades = [
|
|
|
44342
44398
|
});
|
|
44343
44399
|
}
|
|
44344
44400
|
},
|
|
44401
|
+
{
|
|
44402
|
+
name: "ibm-products-update-page-header",
|
|
44403
|
+
description: "Rewrites PageHeader imports to IBM Products packages",
|
|
44404
|
+
migrate: async (options) => {
|
|
44405
|
+
const transform = path.default.join(TRANSFORM_DIR, "ibm-products-update-page-header.js");
|
|
44406
|
+
const paths = Array.isArray(options.paths) && options.paths.length > 0 ? options.paths : await (0, import_out.default)([
|
|
44407
|
+
"**/*.js",
|
|
44408
|
+
"**/*.jsx",
|
|
44409
|
+
"**/*.ts",
|
|
44410
|
+
"**/*.tsx"
|
|
44411
|
+
], {
|
|
44412
|
+
cwd: options.workspaceDir,
|
|
44413
|
+
ignore: [
|
|
44414
|
+
"**/es/**",
|
|
44415
|
+
"**/lib/**",
|
|
44416
|
+
"**/umd/**",
|
|
44417
|
+
"**/node_modules/**",
|
|
44418
|
+
"**/storybook-static/**"
|
|
44419
|
+
]
|
|
44420
|
+
});
|
|
44421
|
+
await runCodemod(options, {
|
|
44422
|
+
dry: !options.write,
|
|
44423
|
+
transform,
|
|
44424
|
+
paths,
|
|
44425
|
+
verbose: options.verbose,
|
|
44426
|
+
parser: "tsx"
|
|
44427
|
+
});
|
|
44428
|
+
}
|
|
44429
|
+
},
|
|
44345
44430
|
{
|
|
44346
44431
|
name: "ibm-products-update-userprofileimage",
|
|
44347
44432
|
description: "Rewrites UserProfileImage to UserAvatar",
|
|
@@ -44362,7 +44447,7 @@ const upgrades = [
|
|
|
44362
44447
|
"**/storybook-static/**"
|
|
44363
44448
|
]
|
|
44364
44449
|
});
|
|
44365
|
-
await
|
|
44450
|
+
await runCodemod(options, {
|
|
44366
44451
|
dry: !options.write,
|
|
44367
44452
|
transform,
|
|
44368
44453
|
paths,
|
|
@@ -44390,7 +44475,7 @@ const upgrades = [
|
|
|
44390
44475
|
"**/storybook-static/**"
|
|
44391
44476
|
]
|
|
44392
44477
|
});
|
|
44393
|
-
await
|
|
44478
|
+
await runCodemod(options, {
|
|
44394
44479
|
dry: !options.write,
|
|
44395
44480
|
transform,
|
|
44396
44481
|
paths,
|
|
@@ -44418,7 +44503,7 @@ const upgrades = [
|
|
|
44418
44503
|
"**/storybook-static/**"
|
|
44419
44504
|
]
|
|
44420
44505
|
});
|
|
44421
|
-
await
|
|
44506
|
+
await runCodemod(options, {
|
|
44422
44507
|
dry: !options.write,
|
|
44423
44508
|
transform,
|
|
44424
44509
|
paths,
|
|
@@ -44446,7 +44531,7 @@ const upgrades = [
|
|
|
44446
44531
|
"**/storybook-static/**"
|
|
44447
44532
|
]
|
|
44448
44533
|
});
|
|
44449
|
-
await
|
|
44534
|
+
await runCodemod(options, {
|
|
44450
44535
|
dry: !options.write,
|
|
44451
44536
|
transform,
|
|
44452
44537
|
paths,
|
|
@@ -44516,7 +44601,7 @@ const upgrades = [
|
|
|
44516
44601
|
"**/coverage/**"
|
|
44517
44602
|
]
|
|
44518
44603
|
});
|
|
44519
|
-
await
|
|
44604
|
+
await runCodemod(options, {
|
|
44520
44605
|
dry: !options.write,
|
|
44521
44606
|
transform,
|
|
44522
44607
|
paths,
|
|
@@ -44545,7 +44630,7 @@ const upgrades = [
|
|
|
44545
44630
|
//#endregion
|
|
44546
44631
|
//#region package.json
|
|
44547
44632
|
var name = "@carbon/upgrade";
|
|
44548
|
-
var version = "11.
|
|
44633
|
+
var version = "11.39.0-rc.0";
|
|
44549
44634
|
//#endregion
|
|
44550
44635
|
//#region ../../node_modules/y18n/build/index.cjs
|
|
44551
44636
|
var require_build$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -45462,7 +45547,7 @@ var require_build$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
45462
45547
|
module.exports = yargsParser;
|
|
45463
45548
|
}));
|
|
45464
45549
|
//#endregion
|
|
45465
|
-
//#region ../../node_modules/wrap-ansi/index.js
|
|
45550
|
+
//#region ../../node_modules/cliui/node_modules/wrap-ansi/index.js
|
|
45466
45551
|
var require_wrap_ansi = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
45467
45552
|
const stringWidth = require_string_width();
|
|
45468
45553
|
const stripAnsi = require_strip_ansi();
|
|
@@ -47819,13 +47904,19 @@ async function main({ argv, cwd }) {
|
|
|
47819
47904
|
default: true,
|
|
47820
47905
|
describe: "wrap the migration with a feature flag",
|
|
47821
47906
|
type: "boolean"
|
|
47907
|
+
}).option("decoratorsBeforeExport", {
|
|
47908
|
+
default: false,
|
|
47909
|
+
describe: "parse decorators before export declarations",
|
|
47910
|
+
type: "boolean"
|
|
47822
47911
|
});
|
|
47823
47912
|
cli.usage("Usage: $0 [options]").command(["upgrade", "$0"], "upgrade your project", {}, run(async (args) => {
|
|
47824
|
-
const { verbose, write } = args;
|
|
47913
|
+
const { decoratorsBeforeExport, verbose, write, wrapWithFeatureFlag } = args;
|
|
47825
47914
|
await upgrade({
|
|
47826
47915
|
cwd: cwd(),
|
|
47916
|
+
decoratorsBeforeExport,
|
|
47827
47917
|
verbose,
|
|
47828
|
-
write
|
|
47918
|
+
write,
|
|
47919
|
+
wrapWithFeatureFlag
|
|
47829
47920
|
}, upgrades);
|
|
47830
47921
|
}));
|
|
47831
47922
|
cli.command("migrate <migration> [paths...]", "run a Carbon migration on your source files", async (cli) => {
|
|
@@ -47838,17 +47929,16 @@ async function main({ argv, cwd }) {
|
|
|
47838
47929
|
}, upgrades);
|
|
47839
47930
|
}, true));
|
|
47840
47931
|
}, run(async (args) => {
|
|
47841
|
-
const { verbose, migration, write, paths, wrapWithFeatureFlag } = args;
|
|
47842
|
-
|
|
47932
|
+
const { verbose, decoratorsBeforeExport, migration, write, paths, wrapWithFeatureFlag } = args;
|
|
47933
|
+
await migrate({
|
|
47843
47934
|
cwd: cwd(),
|
|
47844
47935
|
verbose,
|
|
47936
|
+
decoratorsBeforeExport,
|
|
47845
47937
|
write,
|
|
47846
47938
|
migration,
|
|
47847
47939
|
paths,
|
|
47848
47940
|
wrapWithFeatureFlag
|
|
47849
|
-
};
|
|
47850
|
-
console.log("CLI options wrapWithFeatureFlag:", options.wrapWithFeatureFlag);
|
|
47851
|
-
await migrate(options, upgrades);
|
|
47941
|
+
}, upgrades);
|
|
47852
47942
|
}));
|
|
47853
47943
|
cli.strict().parse(argv.slice(2));
|
|
47854
47944
|
}
|
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.39.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": "3d219dfcc2a3da515016f7ce0e769d013c3a6c03"
|
|
64
64
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Button, preview__PageHeader as PageHeader } from '@carbon/react';
|
|
2
|
+
import {
|
|
3
|
+
PageHeaderBreadcrumbBar,
|
|
4
|
+
PageHeaderContent,
|
|
5
|
+
PageHeaderTabBar,
|
|
6
|
+
} from '@carbon/react';
|
|
7
|
+
|
|
8
|
+
const Example = () => (
|
|
9
|
+
<>
|
|
10
|
+
<Button />
|
|
11
|
+
<PageHeader.Root>
|
|
12
|
+
<PageHeaderBreadcrumbBar />
|
|
13
|
+
<PageHeaderContent title="Title" />
|
|
14
|
+
<PageHeaderTabBar />
|
|
15
|
+
</PageHeader.Root>
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Button } from '@carbon/react';
|
|
2
|
+
import { PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderTabBar } from "@carbon/ibm-products";
|
|
3
|
+
|
|
4
|
+
const Example = () => (
|
|
5
|
+
<>
|
|
6
|
+
<Button />
|
|
7
|
+
<PageHeader.Root>
|
|
8
|
+
<PageHeaderBreadcrumbBar />
|
|
9
|
+
<PageHeaderContent title="Title" />
|
|
10
|
+
<PageHeaderTabBar />
|
|
11
|
+
</PageHeader.Root>
|
|
12
|
+
</>
|
|
13
|
+
);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PageHeader as PageHeaderDirect,
|
|
3
|
+
PageHeaderContentText,
|
|
4
|
+
} from '@carbon/react/es/components/PageHeader/index.js';
|
|
5
|
+
import '@carbon/web-components/es/components/page-header/index.js';
|
|
6
|
+
import '@carbon/web-components/lib/components/page-header/page-header-tabs.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PageHeader as PageHeaderDirect,
|
|
3
|
+
PageHeaderContentText,
|
|
4
|
+
} from "@carbon/ibm-products";
|
|
5
|
+
import "@carbon/ibm-products-web-components/es/components/page-header/index.js";
|
|
6
|
+
import "@carbon/ibm-products-web-components/lib/components/page-header/page-header-tabs.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Link,
|
|
3
|
+
preview__PageHeader as PageHeader,
|
|
4
|
+
PageHeaderContent,
|
|
5
|
+
} from '@carbon/react';
|
|
6
|
+
import { ProductiveCard } from '@carbon/ibm-products';
|
|
7
|
+
import { PageHeaderContentText as Text } from '@carbon/react/es/components/PageHeader/index.js';
|
|
8
|
+
|
|
9
|
+
const Example = () => (
|
|
10
|
+
<>
|
|
11
|
+
<Link href="#" />
|
|
12
|
+
<PageHeader.Root>
|
|
13
|
+
<PageHeaderContent title="Title" />
|
|
14
|
+
<Text>Example</Text>
|
|
15
|
+
</PageHeader.Root>
|
|
16
|
+
<ProductiveCard />
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Link } from '@carbon/react';
|
|
2
|
+
import {
|
|
3
|
+
ProductiveCard,
|
|
4
|
+
PageHeader,
|
|
5
|
+
PageHeaderContent,
|
|
6
|
+
PageHeaderContentText as Text,
|
|
7
|
+
} from '@carbon/ibm-products';
|
|
8
|
+
|
|
9
|
+
const Example = () => (
|
|
10
|
+
<>
|
|
11
|
+
<Link href="#" />
|
|
12
|
+
<PageHeader.Root>
|
|
13
|
+
<PageHeaderContent title="Title" />
|
|
14
|
+
<Text>Example</Text>
|
|
15
|
+
</PageHeader.Root>
|
|
16
|
+
<ProductiveCard />
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026, 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
const { defineTest } = require('jscodeshift/dist/testUtils');
|
|
11
|
+
|
|
12
|
+
defineTest(__dirname, 'ibm-products-update-page-header');
|
|
13
|
+
defineTest(
|
|
14
|
+
__dirname,
|
|
15
|
+
'ibm-products-update-page-header',
|
|
16
|
+
null,
|
|
17
|
+
'ibm-products-update-page-header2'
|
|
18
|
+
);
|
|
19
|
+
defineTest(
|
|
20
|
+
__dirname,
|
|
21
|
+
'ibm-products-update-page-header',
|
|
22
|
+
null,
|
|
23
|
+
'ibm-products-update-page-header3'
|
|
24
|
+
);
|
|
25
|
+
defineTest(
|
|
26
|
+
__dirname,
|
|
27
|
+
'ibm-products-update-page-header',
|
|
28
|
+
null,
|
|
29
|
+
'ibm-products-update-page-header4'
|
|
30
|
+
);
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026, 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Rewrites PageHeader imports from Carbon packages to IBM Products packages.
|
|
10
|
+
*
|
|
11
|
+
* Transforms:
|
|
12
|
+
*
|
|
13
|
+
* import { preview__PageHeader as PageHeader } from '@carbon/react';
|
|
14
|
+
*
|
|
15
|
+
* Into:
|
|
16
|
+
*
|
|
17
|
+
* import { PageHeader } from '@carbon/ibm-products';
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
'use strict';
|
|
21
|
+
|
|
22
|
+
const PRODUCTS_REACT_PATH = '@carbon/ibm-products';
|
|
23
|
+
const PRODUCTS_WEB_COMPONENTS_PATH = '@carbon/ibm-products-web-components';
|
|
24
|
+
const REACT_PAGE_HEADER_IMPORTS = new Set([
|
|
25
|
+
'PageHeader',
|
|
26
|
+
'PageHeaderBreadcrumbBar',
|
|
27
|
+
'PageHeaderContent',
|
|
28
|
+
'PageHeaderContentPageActions',
|
|
29
|
+
'PageHeaderContentText',
|
|
30
|
+
'PageHeaderHeroImage',
|
|
31
|
+
'PageHeaderTabBar',
|
|
32
|
+
'preview__PageHeader',
|
|
33
|
+
'unstable__PageHeader',
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
const normalizeReactImportName = (name) => {
|
|
37
|
+
if (name === 'preview__PageHeader' || name === 'unstable__PageHeader') {
|
|
38
|
+
return 'PageHeader';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return name;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const isReactPageHeaderPath = (value) =>
|
|
45
|
+
/^@carbon\/react\/(es|lib)\/components\/PageHeader(?:\/index(?:\.js)?)?$/.test(
|
|
46
|
+
value
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const rewriteWebComponentsPath = (value) => {
|
|
50
|
+
if (value.startsWith('@carbon/web-components/es/components/page-header')) {
|
|
51
|
+
return value.replace(
|
|
52
|
+
'@carbon/web-components/es/components/page-header',
|
|
53
|
+
`${PRODUCTS_WEB_COMPONENTS_PATH}/es/components/page-header`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (value.startsWith('@carbon/web-components/lib/components/page-header')) {
|
|
58
|
+
return value.replace(
|
|
59
|
+
'@carbon/web-components/lib/components/page-header',
|
|
60
|
+
`${PRODUCTS_WEB_COMPONENTS_PATH}/lib/components/page-header`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return value;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const dedupeSpecifiers = (specifiers) => {
|
|
68
|
+
const seen = new Set();
|
|
69
|
+
|
|
70
|
+
return specifiers.filter((specifier) => {
|
|
71
|
+
if (specifier.type !== 'ImportSpecifier') {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const importedName = specifier.imported.name;
|
|
76
|
+
const localName = specifier.local?.name ?? importedName;
|
|
77
|
+
const key = `${importedName}:${localName}`;
|
|
78
|
+
|
|
79
|
+
if (seen.has(key)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
seen.add(key);
|
|
84
|
+
return true;
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const createPageHeaderSpecifier = (j, specifier) => {
|
|
89
|
+
if (
|
|
90
|
+
specifier.type !== 'ImportSpecifier' ||
|
|
91
|
+
!REACT_PAGE_HEADER_IMPORTS.has(specifier.imported.name)
|
|
92
|
+
) {
|
|
93
|
+
return specifier;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const importedName = normalizeReactImportName(specifier.imported.name);
|
|
97
|
+
const localName = specifier.local?.name;
|
|
98
|
+
|
|
99
|
+
return localName && localName !== importedName
|
|
100
|
+
? j.importSpecifier(j.identifier(importedName), j.identifier(localName))
|
|
101
|
+
: j.importSpecifier(j.identifier(importedName));
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
function transformer(file, api) {
|
|
105
|
+
const j = api.jscodeshift;
|
|
106
|
+
const root = j(file.source);
|
|
107
|
+
|
|
108
|
+
function findProductsReactImport(excludePath) {
|
|
109
|
+
let productsReactImport = null;
|
|
110
|
+
|
|
111
|
+
root
|
|
112
|
+
.find(j.ImportDeclaration, {
|
|
113
|
+
source: {
|
|
114
|
+
value: PRODUCTS_REACT_PATH,
|
|
115
|
+
},
|
|
116
|
+
})
|
|
117
|
+
.forEach((path) => {
|
|
118
|
+
if (!productsReactImport && path !== excludePath) {
|
|
119
|
+
productsReactImport = path;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
return productsReactImport;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function addProductsReactSpecifiers(specifiers, insertAfterPath) {
|
|
127
|
+
const productsReactImport = findProductsReactImport();
|
|
128
|
+
|
|
129
|
+
if (productsReactImport) {
|
|
130
|
+
productsReactImport.node.specifiers = dedupeSpecifiers([
|
|
131
|
+
...productsReactImport.node.specifiers,
|
|
132
|
+
...specifiers,
|
|
133
|
+
]);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const newImportDeclaration = j.importDeclaration(
|
|
138
|
+
dedupeSpecifiers(specifiers),
|
|
139
|
+
j.literal(PRODUCTS_REACT_PATH)
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
j(insertAfterPath).insertAfter(newImportDeclaration);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
root
|
|
146
|
+
.find(j.ImportDeclaration, {
|
|
147
|
+
source: {
|
|
148
|
+
value: '@carbon/react',
|
|
149
|
+
},
|
|
150
|
+
})
|
|
151
|
+
.forEach((path) => {
|
|
152
|
+
const movedSpecifiers = [];
|
|
153
|
+
const remainingSpecifiers = [];
|
|
154
|
+
|
|
155
|
+
path.node.specifiers.forEach((specifier) => {
|
|
156
|
+
if (
|
|
157
|
+
specifier.type === 'ImportSpecifier' &&
|
|
158
|
+
REACT_PAGE_HEADER_IMPORTS.has(specifier.imported.name)
|
|
159
|
+
) {
|
|
160
|
+
movedSpecifiers.push(createPageHeaderSpecifier(j, specifier));
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
remainingSpecifiers.push(specifier);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
if (movedSpecifiers.length === 0) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (remainingSpecifiers.length === 0) {
|
|
172
|
+
const productsReactImport = findProductsReactImport(path);
|
|
173
|
+
|
|
174
|
+
if (productsReactImport) {
|
|
175
|
+
productsReactImport.node.specifiers = dedupeSpecifiers([
|
|
176
|
+
...productsReactImport.node.specifiers,
|
|
177
|
+
...movedSpecifiers,
|
|
178
|
+
]);
|
|
179
|
+
j(path).remove();
|
|
180
|
+
} else {
|
|
181
|
+
const newImportDeclaration = j.importDeclaration(
|
|
182
|
+
dedupeSpecifiers(movedSpecifiers),
|
|
183
|
+
j.literal(PRODUCTS_REACT_PATH)
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
j(path).replaceWith(newImportDeclaration);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
path.node.specifiers = remainingSpecifiers;
|
|
193
|
+
addProductsReactSpecifiers(movedSpecifiers, path);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
root.find(j.ImportDeclaration).forEach((path) => {
|
|
197
|
+
const sourceValue = path.node.source.value;
|
|
198
|
+
|
|
199
|
+
if (typeof sourceValue !== 'string') {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (isReactPageHeaderPath(sourceValue)) {
|
|
204
|
+
const specifiers = path.node.specifiers.map((specifier) =>
|
|
205
|
+
createPageHeaderSpecifier(j, specifier)
|
|
206
|
+
);
|
|
207
|
+
const productsReactImport = findProductsReactImport(path);
|
|
208
|
+
|
|
209
|
+
if (productsReactImport) {
|
|
210
|
+
productsReactImport.node.specifiers = dedupeSpecifiers([
|
|
211
|
+
...productsReactImport.node.specifiers,
|
|
212
|
+
...specifiers,
|
|
213
|
+
]);
|
|
214
|
+
j(path).remove();
|
|
215
|
+
} else {
|
|
216
|
+
path.node.source = j.literal(PRODUCTS_REACT_PATH);
|
|
217
|
+
path.node.specifiers = dedupeSpecifiers(specifiers);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const rewrittenWebComponentsPath = rewriteWebComponentsPath(sourceValue);
|
|
224
|
+
|
|
225
|
+
if (rewrittenWebComponentsPath !== sourceValue) {
|
|
226
|
+
path.node.source = j.literal(rewrittenWebComponentsPath);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
return root.toSource();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
module.exports = transformer;
|