@navikt/aksel 8.10.0 → 8.10.2
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/dist/codemod/codeshift.utils.d.ts +12 -0
- package/dist/codemod/index.d.ts +1 -0
- package/dist/codemod/migrations.d.ts +45 -0
- package/dist/codemod/migrations.js +9 -182
- package/dist/codemod/run-codeshift.d.ts +2 -0
- package/dist/codemod/run-version-migration.d.ts +15 -0
- package/dist/codemod/tokens-map.d.ts +2 -0
- package/dist/codemod/transforms/rename-prop/rename-prop.d.ts +2 -0
- package/dist/codemod/transforms/v1.0.0/chat/chat.d.ts +2 -0
- package/dist/codemod/transforms/v1.0.0/pagination/pagination.d.ts +2 -0
- package/dist/codemod/transforms/v1.0.0/preset/preset.d.ts +2 -0
- package/dist/codemod/transforms/v1.0.0/tabs/tabs.d.ts +2 -0
- package/dist/codemod/transforms/v2.0.0/update-css-tokens/update-css-tokens.d.ts +2 -0
- package/dist/codemod/transforms/v2.0.0/update-js-tokens/update-js-tokens.d.ts +6 -0
- package/dist/codemod/transforms/v2.0.0/update-less-tokens/update-less-tokens.d.ts +2 -0
- package/dist/codemod/transforms/v2.0.0/update-sass-tokens/update-sass-tokens.d.ts +2 -0
- package/dist/codemod/transforms/v3.0.0/copybutton/copybutton.d.ts +2 -0
- package/dist/codemod/transforms/v4.0.0/date/date.d.ts +2 -0
- package/dist/codemod/transforms/v4.0.0/internal-css/internal-css.d.ts +2 -0
- package/dist/codemod/transforms/v4.0.0/internal-react/internal-react.d.ts +2 -0
- package/dist/codemod/transforms/v6.0.0/chat/chat.d.ts +2 -0
- package/dist/codemod/transforms/v8.0.0/accordion-variant/accordion-variant.d.ts +14 -0
- package/dist/codemod/transforms/v8.0.0/box/box.d.ts +2 -0
- package/dist/codemod/transforms/v8.0.0/box-new/box-new.d.ts +2 -0
- package/dist/codemod/transforms/v8.0.0/button-variant/button-variant.d.ts +24 -0
- package/dist/codemod/transforms/v8.0.0/chips-variant/chips-variant.d.ts +2 -0
- package/dist/codemod/transforms/v8.0.0/link-variant/link-variant.d.ts +17 -0
- package/dist/codemod/transforms/v8.0.0/list/list.d.ts +2 -0
- package/dist/codemod/transforms/v8.0.0/primitives-spacing/spacing.d.ts +2 -0
- package/dist/codemod/transforms/v8.0.0/prop-deprecate/prop-deprecate.d.ts +2 -0
- package/dist/codemod/transforms/v8.0.0/spacing.utils.d.ts +6 -0
- package/dist/codemod/transforms/v8.0.0/tag-variant/tag-variant.d.ts +104 -0
- package/dist/codemod/transforms/v8.0.0/toggle-group-variant/toggle-group-variant.d.ts +14 -0
- package/dist/codemod/utils/ast.d.ts +30 -0
- package/dist/codemod/utils/check.d.ts +33 -0
- package/dist/codemod/utils/imports.d.ts +4 -0
- package/dist/codemod/utils/jsx-value.d.ts +32 -0
- package/dist/codemod/utils/lineterminator.d.ts +3 -0
- package/dist/codemod/utils/move-variant-to-data-color.d.ts +10 -0
- package/dist/codemod/utils/packageImports.d.ts +14 -0
- package/dist/codemod/utils/removeProps.d.ts +2 -0
- package/dist/codemod/utils/rename-props.d.ts +8 -0
- package/dist/codemod/utils/translate-token.d.ts +1 -0
- package/dist/codemod/v8-tokens/config/TokenStatus.d.ts +71 -0
- package/dist/codemod/v8-tokens/config/legacy-component.tokens.d.ts +2 -0
- package/dist/codemod/v8-tokens/config/legacy.tokens.d.ts +13 -0
- package/dist/codemod/v8-tokens/config/token-regex.d.ts +8 -0
- package/dist/codemod/v8-tokens/config/token.utils.d.ts +3 -0
- package/dist/codemod/v8-tokens/config/v8.tokens.d.ts +7 -0
- package/dist/codemod/v8-tokens/index.d.ts +2 -0
- package/dist/codemod/v8-tokens/run-tooling.d.ts +12 -0
- package/dist/codemod/v8-tokens/tasks/print-remaining.d.ts +3 -0
- package/dist/codemod/v8-tokens/tasks/status.d.ts +18 -0
- package/dist/codemod/v8-tokens/transforms/v8-tokens-css.d.ts +2 -0
- package/dist/codemod/v8-tokens/transforms/v8-tokens-js.d.ts +2 -0
- package/dist/codemod/v8-tokens/transforms/v8-tokens-less.d.ts +2 -0
- package/dist/codemod/v8-tokens/transforms/v8-tokens-scss.d.ts +2 -0
- package/dist/codemod/v8-tokens/transforms/v8-tokens-tailwind.d.ts +2 -0
- package/dist/codemod/validation.d.ts +3 -0
- package/dist/help.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/migrations-config.d.ts +14 -0
- package/dist/migrations-config.js +178 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -1
- package/package.json +11 -4
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
+
export declare const migrationConfig: {
|
|
3
|
+
component: string;
|
|
4
|
+
prop: string;
|
|
5
|
+
changes: {
|
|
6
|
+
warning: {
|
|
7
|
+
replacement: string;
|
|
8
|
+
color: string;
|
|
9
|
+
};
|
|
10
|
+
"warning-moderate": {
|
|
11
|
+
replacement: string;
|
|
12
|
+
color: string;
|
|
13
|
+
};
|
|
14
|
+
"warning-filled": {
|
|
15
|
+
replacement: string;
|
|
16
|
+
color: string;
|
|
17
|
+
};
|
|
18
|
+
error: {
|
|
19
|
+
replacement: string;
|
|
20
|
+
color: string;
|
|
21
|
+
};
|
|
22
|
+
"error-moderate": {
|
|
23
|
+
replacement: string;
|
|
24
|
+
color: string;
|
|
25
|
+
};
|
|
26
|
+
"error-filled": {
|
|
27
|
+
replacement: string;
|
|
28
|
+
color: string;
|
|
29
|
+
};
|
|
30
|
+
info: {
|
|
31
|
+
replacement: string;
|
|
32
|
+
color: string;
|
|
33
|
+
};
|
|
34
|
+
"info-moderate": {
|
|
35
|
+
replacement: string;
|
|
36
|
+
color: string;
|
|
37
|
+
};
|
|
38
|
+
"info-filled": {
|
|
39
|
+
replacement: string;
|
|
40
|
+
color: string;
|
|
41
|
+
};
|
|
42
|
+
success: {
|
|
43
|
+
replacement: string;
|
|
44
|
+
color: string;
|
|
45
|
+
};
|
|
46
|
+
"success-moderate": {
|
|
47
|
+
replacement: string;
|
|
48
|
+
color: string;
|
|
49
|
+
};
|
|
50
|
+
"success-filled": {
|
|
51
|
+
replacement: string;
|
|
52
|
+
color: string;
|
|
53
|
+
};
|
|
54
|
+
neutral: {
|
|
55
|
+
replacement: string;
|
|
56
|
+
color: string;
|
|
57
|
+
};
|
|
58
|
+
"neutral-moderate": {
|
|
59
|
+
replacement: string;
|
|
60
|
+
color: string;
|
|
61
|
+
};
|
|
62
|
+
"neutral-filled": {
|
|
63
|
+
replacement: string;
|
|
64
|
+
color: string;
|
|
65
|
+
};
|
|
66
|
+
alt1: {
|
|
67
|
+
replacement: string;
|
|
68
|
+
color: string;
|
|
69
|
+
};
|
|
70
|
+
"alt1-moderate": {
|
|
71
|
+
replacement: string;
|
|
72
|
+
color: string;
|
|
73
|
+
};
|
|
74
|
+
"alt1-filled": {
|
|
75
|
+
replacement: string;
|
|
76
|
+
color: string;
|
|
77
|
+
};
|
|
78
|
+
alt2: {
|
|
79
|
+
replacement: string;
|
|
80
|
+
color: string;
|
|
81
|
+
};
|
|
82
|
+
"alt2-moderate": {
|
|
83
|
+
replacement: string;
|
|
84
|
+
color: string;
|
|
85
|
+
};
|
|
86
|
+
"alt2-filled": {
|
|
87
|
+
replacement: string;
|
|
88
|
+
color: string;
|
|
89
|
+
};
|
|
90
|
+
alt3: {
|
|
91
|
+
replacement: string;
|
|
92
|
+
color: string;
|
|
93
|
+
};
|
|
94
|
+
"alt3-moderate": {
|
|
95
|
+
replacement: string;
|
|
96
|
+
color: string;
|
|
97
|
+
};
|
|
98
|
+
"alt3-filled": {
|
|
99
|
+
replacement: string;
|
|
100
|
+
color: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export default function transformer(file: FileInfo, api: API): string | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
+
export declare const migrationConfig: {
|
|
3
|
+
component: string;
|
|
4
|
+
prop: string;
|
|
5
|
+
changes: {
|
|
6
|
+
action: {
|
|
7
|
+
color: string;
|
|
8
|
+
};
|
|
9
|
+
neutral: {
|
|
10
|
+
color: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default function transformer(file: FileInfo, api: API): string | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { API, ASTPath, JSXElement } from "jscodeshift";
|
|
2
|
+
/**
|
|
3
|
+
* Finds a component import, accounting for sub-components and aliases.
|
|
4
|
+
* Returns the local name of the component. If the component is not found, returns null.
|
|
5
|
+
* root should ideally be the root of the file in most cases (imports happen at top level)
|
|
6
|
+
*/
|
|
7
|
+
declare function findComponentImport(input: {
|
|
8
|
+
j: API["j"];
|
|
9
|
+
root: ReturnType<API["j"]>;
|
|
10
|
+
name: string;
|
|
11
|
+
packageType?: "react" | "tokens";
|
|
12
|
+
}): null;
|
|
13
|
+
/**
|
|
14
|
+
* Finds a JSX element in the AST, accounting for sub-components.
|
|
15
|
+
*/
|
|
16
|
+
declare function findJSXElement(input: {
|
|
17
|
+
root: ReturnType<API["j"]>;
|
|
18
|
+
j: API["j"];
|
|
19
|
+
name: string;
|
|
20
|
+
originalName: string;
|
|
21
|
+
}): import("jscodeshift/src/Collection").Collection<JSXElement>;
|
|
22
|
+
/**
|
|
23
|
+
* Finds a prop in a JSX element.
|
|
24
|
+
*/
|
|
25
|
+
declare function findProps(input: {
|
|
26
|
+
j: API["j"];
|
|
27
|
+
path: ASTPath<JSXElement>;
|
|
28
|
+
name: string;
|
|
29
|
+
}): import("jscodeshift/src/Collection").Collection<import("ast-types").namedTypes.JSXAttribute>;
|
|
30
|
+
export { findComponentImport, findJSXElement, findProps };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
interface TestT {
|
|
2
|
+
fixture: string;
|
|
3
|
+
migration: string;
|
|
4
|
+
extension?: "js" | "scss" | "less" | "css";
|
|
5
|
+
options?: {
|
|
6
|
+
[option: string]: any;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
interface ScenarioT {
|
|
10
|
+
migration: string;
|
|
11
|
+
scenarios: Record<string, {
|
|
12
|
+
input: string;
|
|
13
|
+
output: string;
|
|
14
|
+
}>;
|
|
15
|
+
extension?: "js" | "scss" | "less" | "css";
|
|
16
|
+
options?: {
|
|
17
|
+
[option: string]: any;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare function check(dirName: string, { fixture, migration, extension, options }: TestT): void;
|
|
21
|
+
export declare function checkScenarios(dirName: string, { migration, scenarios, extension, options }: ScenarioT): void;
|
|
22
|
+
export declare function checkMoveVariantToDataColor(dirName: string, { migration, config, }: {
|
|
23
|
+
migration: string;
|
|
24
|
+
config: {
|
|
25
|
+
component: string;
|
|
26
|
+
prop: string;
|
|
27
|
+
changes: Record<string, {
|
|
28
|
+
replacement?: string;
|
|
29
|
+
color: string;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
}): void;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import core, { Collection } from "jscodeshift";
|
|
2
|
+
export declare function getImportSpecifier(j: core.JSCodeshift, source: Collection<any>, specifier: string, sourcePath: string): import("jscodeshift/src/Collection").Collection<import("ast-types").namedTypes.ImportSpecifier>;
|
|
3
|
+
export declare function renameImportSpecifier(j: core.JSCodeshift, source: Collection<any>, specifier: string, newSpecifier: string, sourcePath: string): void;
|
|
4
|
+
export declare function getImportSpecifierName(j: core.JSCodeshift, source: Collection<any>, specifier: string, sourcePath: string): string | import("ast-types/lib/gen/kinds").IdentifierKind | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { JSXAttribute, JSXExpressionContainer } from "jscodeshift";
|
|
2
|
+
type AttributeValue = JSXAttribute["value"] | JSXExpressionContainer["expression"];
|
|
3
|
+
type LiteralValue = string | number | boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Extracts a literal value (string, number, or boolean) from a JSX attribute value.
|
|
6
|
+
* Handles the following patterns:
|
|
7
|
+
* - `prop="value"` (StringLiteral)
|
|
8
|
+
* - `prop={"value"}` (JSXExpressionContainer with StringLiteral)
|
|
9
|
+
* - `prop={`value`}` (TemplateLiteral with no expressions)
|
|
10
|
+
* - `prop={42}` (NumericLiteral)
|
|
11
|
+
* - `prop={true}` / `prop={false}` (BooleanLiteral)
|
|
12
|
+
*
|
|
13
|
+
* @param node - The JSX attribute value node to extract the value from
|
|
14
|
+
* @returns The literal value if it can be extracted, otherwise null
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* getJSXLiteralValue(attr.value) // where attr is prop="hello" => "hello"
|
|
19
|
+
* getJSXLiteralValue(attr.value) // where attr is prop={42} => 42
|
|
20
|
+
* getJSXLiteralValue(attr.value) // where attr is prop={true} => true
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function getJSXLiteralValue(node: AttributeValue): LiteralValue | null;
|
|
24
|
+
/**
|
|
25
|
+
* Extracts the string value from a JSX attribute value.
|
|
26
|
+
* Convenience wrapper around `getJSXLiteralValue` that only returns strings.
|
|
27
|
+
*
|
|
28
|
+
* @param node - The JSX attribute value node to extract the string from
|
|
29
|
+
* @returns The string value if it can be extracted, otherwise null
|
|
30
|
+
*/
|
|
31
|
+
export declare function getJSXStringValue(node: AttributeValue): string | null;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
+
export interface MigrationConfig {
|
|
3
|
+
component: string;
|
|
4
|
+
prop: string;
|
|
5
|
+
changes: Record<string, {
|
|
6
|
+
replacement?: string;
|
|
7
|
+
color: string;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
export declare function moveVariantToDataColor(file: FileInfo, api: API, config: MigrationConfig): string | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import core, { Collection, JSCodeshift } from "jscodeshift";
|
|
2
|
+
export declare const addPackageImport: ({ j, root, packageName, specifiers, }: {
|
|
3
|
+
j: JSCodeshift;
|
|
4
|
+
root: Collection<any>;
|
|
5
|
+
packageName: string;
|
|
6
|
+
specifiers: string[];
|
|
7
|
+
}) => void;
|
|
8
|
+
export default function moveAndRenameImport(j: core.JSCodeshift, root: Collection<any>, { fromImport, toImport, fromName, toName, ignoreAlias, }: {
|
|
9
|
+
fromImport: string;
|
|
10
|
+
toImport: string;
|
|
11
|
+
fromName: string;
|
|
12
|
+
toName: string;
|
|
13
|
+
ignoreAlias?: boolean;
|
|
14
|
+
}): string | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Collection } from "jscodeshift";
|
|
2
|
+
interface RenamePropsOptions {
|
|
3
|
+
root: Collection;
|
|
4
|
+
componentName: string;
|
|
5
|
+
props: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
export default function renameProps({ root, componentName, props, }: RenamePropsOptions): import("jscodeshift/src/Collection").Collection<import("ast-types").namedTypes.JSXElement>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const translateToken: (token: string, type: "scss" | "less" | "js") => string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
type TokenDataT = {
|
|
2
|
+
name: string;
|
|
3
|
+
canAutoMigrate?: boolean;
|
|
4
|
+
fileName: string;
|
|
5
|
+
lineNumber: number;
|
|
6
|
+
columnNumber: number;
|
|
7
|
+
comment?: string;
|
|
8
|
+
};
|
|
9
|
+
type StatusDataT = {
|
|
10
|
+
legacy: TokenDataT[];
|
|
11
|
+
updated: TokenDataT[];
|
|
12
|
+
};
|
|
13
|
+
type StatusT = {
|
|
14
|
+
css: StatusDataT;
|
|
15
|
+
scss: StatusDataT;
|
|
16
|
+
less: StatusDataT;
|
|
17
|
+
js: StatusDataT;
|
|
18
|
+
tailwind: StatusDataT;
|
|
19
|
+
component: StatusDataT;
|
|
20
|
+
deprecated: StatusDataT;
|
|
21
|
+
};
|
|
22
|
+
declare class TokenStatus {
|
|
23
|
+
status: StatusT;
|
|
24
|
+
constructor();
|
|
25
|
+
initStatus(): {
|
|
26
|
+
css: {
|
|
27
|
+
legacy: never[];
|
|
28
|
+
updated: never[];
|
|
29
|
+
};
|
|
30
|
+
scss: {
|
|
31
|
+
legacy: never[];
|
|
32
|
+
updated: never[];
|
|
33
|
+
};
|
|
34
|
+
less: {
|
|
35
|
+
legacy: never[];
|
|
36
|
+
updated: never[];
|
|
37
|
+
};
|
|
38
|
+
js: {
|
|
39
|
+
legacy: never[];
|
|
40
|
+
updated: never[];
|
|
41
|
+
};
|
|
42
|
+
tailwind: {
|
|
43
|
+
legacy: never[];
|
|
44
|
+
updated: never[];
|
|
45
|
+
};
|
|
46
|
+
component: {
|
|
47
|
+
legacy: never[];
|
|
48
|
+
updated: never[];
|
|
49
|
+
};
|
|
50
|
+
deprecated: {
|
|
51
|
+
legacy: never[];
|
|
52
|
+
updated: never[];
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
resetStatus(): void;
|
|
56
|
+
add({ isLegacy, type, ...hit }: {
|
|
57
|
+
type: keyof StatusT;
|
|
58
|
+
isLegacy: boolean;
|
|
59
|
+
name: string;
|
|
60
|
+
fileName: string;
|
|
61
|
+
lineNumber: number;
|
|
62
|
+
columnNumber: number;
|
|
63
|
+
canAutoMigrate?: boolean;
|
|
64
|
+
comment?: string;
|
|
65
|
+
}): void;
|
|
66
|
+
printStatusForAll(): void;
|
|
67
|
+
printStatus(type: keyof StatusT | "summary"): void;
|
|
68
|
+
printMigrationHelp(): void;
|
|
69
|
+
}
|
|
70
|
+
export { TokenStatus };
|
|
71
|
+
export type { StatusT, StatusDataT };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getFrameworkRegexes } from "./token-regex";
|
|
2
|
+
type LegacyTokenConfig = {
|
|
3
|
+
ref: string;
|
|
4
|
+
raw: `${string}rem` | `${string}px` | `${string} ${string}` | `${number}`;
|
|
5
|
+
replacement: string;
|
|
6
|
+
comment?: string;
|
|
7
|
+
twOld?: string;
|
|
8
|
+
twNew?: string;
|
|
9
|
+
regexes: ReturnType<typeof getFrameworkRegexes>;
|
|
10
|
+
};
|
|
11
|
+
declare const legacyTokenConfig: Record<string, LegacyTokenConfig>;
|
|
12
|
+
export { legacyTokenConfig };
|
|
13
|
+
export type { LegacyTokenConfig };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare function getFrameworkRegexes({ token, twString, legacy, }: {
|
|
2
|
+
token: string;
|
|
3
|
+
twString?: string | null;
|
|
4
|
+
legacy: boolean;
|
|
5
|
+
}): Record<"css" | "scss" | "less" | "js" | "tailwind", RegExp | null>;
|
|
6
|
+
declare function getTokenRegex(variable: string, format: "css" | "scss" | "less" | "js"): RegExp;
|
|
7
|
+
declare function createCompositeTwRegex(tokens: string[]): RegExp;
|
|
8
|
+
export { createCompositeTwRegex, getFrameworkRegexes, getTokenRegex };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
type ToolingOptions = {
|
|
3
|
+
force: boolean;
|
|
4
|
+
dryRun: boolean;
|
|
5
|
+
glob: string;
|
|
6
|
+
ext: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Main entry point for the tooling system
|
|
10
|
+
*/
|
|
11
|
+
export declare function runTooling(options: ToolingOptions, program: Command): Promise<void>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TokenStatus } from "../config/TokenStatus";
|
|
2
|
+
/**
|
|
3
|
+
* Get the status of the tokens in the files
|
|
4
|
+
*/
|
|
5
|
+
declare function getStatus(files: string[], action?: "no-print" | "print"): TokenStatus;
|
|
6
|
+
/**
|
|
7
|
+
* Given the content of a file, returns an array of line start positions.
|
|
8
|
+
*/
|
|
9
|
+
declare function getLineStarts(content: string): number[];
|
|
10
|
+
/**
|
|
11
|
+
* Given a character index and an array of line start positions,
|
|
12
|
+
* returns the corresponding row and column numbers.
|
|
13
|
+
*/
|
|
14
|
+
declare function getCharacterPositionInFile(index: number, lineStarts: number[]): {
|
|
15
|
+
row: number;
|
|
16
|
+
column: number;
|
|
17
|
+
};
|
|
18
|
+
export { getStatus, getCharacterPositionInFile, getLineStarts };
|
package/dist/help.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function helpCommand(): void;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SupportedCodemodExtensions } from "./codemod/codeshift.utils";
|
|
2
|
+
type MigrationT = Record<string, {
|
|
3
|
+
description: string;
|
|
4
|
+
value: string;
|
|
5
|
+
path: string;
|
|
6
|
+
warning?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Some transforms are only meant to run on specific file extensions.
|
|
9
|
+
* This is used to filter out files that should not be transformed.
|
|
10
|
+
*/
|
|
11
|
+
ignoredExtensions: SupportedCodemodExtensions[];
|
|
12
|
+
}[]>;
|
|
13
|
+
declare const migrations: MigrationT;
|
|
14
|
+
export { migrations };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrations = void 0;
|
|
4
|
+
const JS_EXTENSIONS = [
|
|
5
|
+
"js",
|
|
6
|
+
"jsx",
|
|
7
|
+
"ts",
|
|
8
|
+
"tsx",
|
|
9
|
+
];
|
|
10
|
+
const CSS_EXTENSIONS = [
|
|
11
|
+
"css",
|
|
12
|
+
"scss",
|
|
13
|
+
"less",
|
|
14
|
+
];
|
|
15
|
+
const migrations = {
|
|
16
|
+
v1: [
|
|
17
|
+
{
|
|
18
|
+
description: "Runs all codemods for beta -> v1 migration",
|
|
19
|
+
value: "v1-preset",
|
|
20
|
+
path: "v1.0.0/preset/preset",
|
|
21
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
description: "Fixes breaking API-changes for <Pagination /> component",
|
|
25
|
+
value: "v1-pagination",
|
|
26
|
+
path: "v1.0.0/pagination/pagination",
|
|
27
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
description: "Fixes breaking API-changes for <Tabs /> component",
|
|
31
|
+
value: "v1-tabs",
|
|
32
|
+
path: "v1.0.0/tabs/tabs",
|
|
33
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
description: "Fixes breaking API-changes for <SpeechBubble /> (now <Chat/>) component",
|
|
37
|
+
value: "v1-chat",
|
|
38
|
+
path: "v1.0.0/chat/chat",
|
|
39
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
v2: [
|
|
43
|
+
{
|
|
44
|
+
description: "Patches changed css-variables",
|
|
45
|
+
value: "v2-css",
|
|
46
|
+
path: "v2.0.0/update-css-tokens/update-css-tokens",
|
|
47
|
+
ignoredExtensions: [],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
description: "Patches changed js-variables",
|
|
51
|
+
value: "v2-js",
|
|
52
|
+
path: "v2.0.0/update-js-tokens/update-js-tokens",
|
|
53
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
description: "Patches changed sass-variables",
|
|
57
|
+
value: "v2-sass",
|
|
58
|
+
path: "v2.0.0/update-sass-tokens/update-sass-tokens",
|
|
59
|
+
ignoredExtensions: JS_EXTENSIONS,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
description: "Patches changed less-variables",
|
|
63
|
+
value: "v2-less",
|
|
64
|
+
path: "v2.0.0/update-less-tokens/update-less-tokens",
|
|
65
|
+
ignoredExtensions: JS_EXTENSIONS,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
v3: [
|
|
69
|
+
{
|
|
70
|
+
description: "Replaces deprecated <CopyToClipboard /> with <CopyButton />",
|
|
71
|
+
value: "v3-copybutton",
|
|
72
|
+
path: "v3.0.0/copybutton/copybutton",
|
|
73
|
+
warning: "Remember to remove css-import from '@navikt/ds-css-internal' if no longer needed\nIf non-text was used as children, or different locales were handled, you need to manually fix this",
|
|
74
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
v4: [
|
|
78
|
+
{
|
|
79
|
+
description: "Replaced deprecated 'internal'-component import to 'core'-imports",
|
|
80
|
+
value: "v4-internal-react",
|
|
81
|
+
path: "v4.0.0/internal-react/internal-react",
|
|
82
|
+
warning: "Remember to also run 'v4-internal-css' if you have overwritten any css-classes!",
|
|
83
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
description: "Replaced 'navdsi'-prefixes used to overwrite internal-css to 'navds'-prefixes",
|
|
87
|
+
value: "v4-internal-css",
|
|
88
|
+
path: "v4.0.0/internal-css/internal-css",
|
|
89
|
+
warning: "Remember to remove '@navikt/ds-css-internal' imports if no longer needed! Also run 'v4-internal-react' to convert internal-react imports to core-imports",
|
|
90
|
+
ignoredExtensions: [],
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
description: "Removes all instances of UNSAFE_ for datepicker/monthpicker.",
|
|
94
|
+
value: "v4-date",
|
|
95
|
+
path: "v4.0.0/date/date",
|
|
96
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
v6: [
|
|
100
|
+
{
|
|
101
|
+
description: "Removes `backgroundColor` and `avatarBgColor` properties from `Chat` and `Chat.Bubble`",
|
|
102
|
+
value: "v6-chat",
|
|
103
|
+
path: "v6.0.0/chat/chat",
|
|
104
|
+
warning: "Remember to update use of `variant`-prop to match previous use of colors. If needed the component exposes css-variables for custom overrides",
|
|
105
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
v8: [
|
|
109
|
+
{
|
|
110
|
+
description: "Updates Box with legacy-tokens to Box using the new token system, and renames already migrated BoxNew/Box.New instances to Box.",
|
|
111
|
+
value: "v8-box",
|
|
112
|
+
path: "v8.0.0/box/box",
|
|
113
|
+
warning: "Remember to check if 'TODO: Aksel Box migration'-comment was added to any files after migration. This comment will help you find and update Box-instances we couldn't update for you.",
|
|
114
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
description: "Renames already migrated BoxNew/Box.New instances to Box.",
|
|
118
|
+
value: "v8-box-new",
|
|
119
|
+
path: "v8.0.0/box-new/box-new",
|
|
120
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
description: "Removes deprecated props from components.",
|
|
124
|
+
value: "v8-prop-deprecate",
|
|
125
|
+
path: "v8.0.0/prop-deprecate/prop-deprecate",
|
|
126
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
description: "Tries to migrate List component by wrapping it with 'Box' and moving 'title' and 'description' props to 'Heading' and 'BodyShort'.",
|
|
130
|
+
value: "v8-list",
|
|
131
|
+
path: "v8.0.0/list/list",
|
|
132
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
description: "Updates all Primitives to use new `space`-tokens.",
|
|
136
|
+
value: "v8-primitive-spacing",
|
|
137
|
+
path: "v8.0.0/primitives-spacing/spacing",
|
|
138
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
description: "Updates variant + data-color props on Tag based on current variant prop.",
|
|
142
|
+
value: "v8-tag-variant",
|
|
143
|
+
path: "v8.0.0/tag-variant/tag-variant",
|
|
144
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
description: "Updates variant + data-color props on ToggleGroup based on current variant prop.",
|
|
148
|
+
value: "v8-toggle-group-variant",
|
|
149
|
+
path: "v8.0.0/toggle-group-variant/toggle-group-variant",
|
|
150
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
description: "Updates variant + data-color props on Accordion based on current variant prop.",
|
|
154
|
+
value: "v8-accordion-variant",
|
|
155
|
+
path: "v8.0.0/accordion-variant/accordion-variant",
|
|
156
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
description: "Updates variant + data-color props on Chips based on current variant prop.",
|
|
160
|
+
value: "v8-chips-variant",
|
|
161
|
+
path: "v8.0.0/chips-variant/chips-variant",
|
|
162
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
description: "Updates variant + data-color props on Button based on current variant prop.",
|
|
166
|
+
value: "v8-button-variant",
|
|
167
|
+
path: "v8.0.0/button-variant/button-variant",
|
|
168
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
description: "Updates variant + data-color props on Link based on current variant prop.",
|
|
172
|
+
value: "v8-link-variant",
|
|
173
|
+
path: "v8.0.0/link-variant/link-variant",
|
|
174
|
+
ignoredExtensions: CSS_EXTENSIONS,
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
};
|
|
178
|
+
exports.migrations = migrations;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION = "8.10.2";
|
package/dist/version.js
CHANGED