@navikt/aksel 2.9.3 → 2.9.4
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 +157 -1
- package/dist/codemod/index.js +36 -0
- package/dist/codemod/migrations.js +75 -0
- package/dist/codemod/run-codeshift.js +91 -0
- package/dist/codemod/tokens-map.mjs +364 -0
- package/dist/codemod/transforms/rename-prop/rename-prop.js +21 -0
- package/dist/codemod/transforms/v1.0.0/chat/chat.js +65 -0
- package/dist/codemod/transforms/v1.0.0/pagination/pagination.js +66 -0
- package/dist/codemod/transforms/v1.0.0/preset/preset.js +19 -0
- package/dist/codemod/transforms/v1.0.0/tabs/tabs.js +78 -0
- package/dist/codemod/transforms/v2.0.0/update-css-tokens/update-css-tokens.js +21 -0
- package/dist/codemod/transforms/v2.0.0/update-js-tokens/update-js-tokens.js +36 -0
- package/dist/codemod/transforms/v2.0.0/update-less-tokens/update-less-tokens.js +18 -0
- package/dist/codemod/transforms/v2.0.0/update-sass-tokens/update-sass-tokens.js +18 -0
- package/dist/codemod/utils/check.js +66 -0
- package/dist/codemod/utils/imports.js +20 -0
- package/dist/codemod/utils/rename-props.js +13 -0
- package/dist/codemod/utils/translate-token.js +20 -0
- package/dist/codemod/validation.js +41 -0
- package/dist/css-imports/config.js +5 -2
- package/dist/css-imports/generate-output.js +42 -35
- package/dist/css-imports/get-directories.js +12 -5
- package/dist/css-imports/get-version.js +11 -4
- package/dist/css-imports/index.js +36 -33
- package/dist/css-imports/inquiry.js +11 -4
- package/dist/css-imports/scan-code.js +10 -5
- package/dist/help.js +17 -6
- package/dist/index.js +22 -6
- package/package.json +19 -11
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* prettier-ignore */
|
|
4
|
+
const tokens = [
|
|
5
|
+
["--navds-semantic-color-text-inverted", "--a-text-on-inverted"],
|
|
6
|
+
["--navds-semantic-color-text-muted", "--a-text-subtle"],
|
|
7
|
+
["--navds-semantic-color-text", "--a-text-default"],
|
|
8
|
+
["--navds-semantic-color-feedback-danger-text", "--a-text-danger"],
|
|
9
|
+
["--navds-semantic-color-link-visited", "--a-text-visited"],
|
|
10
|
+
["--navds-semantic-color-link", "--a-text-action"],
|
|
11
|
+
["--navds-spacing-32", "--a-spacing-32"],
|
|
12
|
+
["--navds-spacing-24", "--a-spacing-24"],
|
|
13
|
+
["--navds-spacing-20", "--a-spacing-20"],
|
|
14
|
+
["--navds-spacing-18", "--a-spacing-18"],
|
|
15
|
+
["--navds-spacing-16", "--a-spacing-16"],
|
|
16
|
+
["--navds-spacing-14", "--a-spacing-14"],
|
|
17
|
+
["--navds-spacing-12", "--a-spacing-12"],
|
|
18
|
+
["--navds-spacing-11", "--a-spacing-11"],
|
|
19
|
+
["--navds-spacing-10", "--a-spacing-10"],
|
|
20
|
+
["--navds-spacing-9", "--a-spacing-9"],
|
|
21
|
+
["--navds-spacing-8", "--a-spacing-8"],
|
|
22
|
+
["--navds-spacing-7", "--a-spacing-7"],
|
|
23
|
+
["--navds-spacing-6", "--a-spacing-6"],
|
|
24
|
+
["--navds-spacing-5", "--a-spacing-5"],
|
|
25
|
+
["--navds-spacing-4", "--a-spacing-4"],
|
|
26
|
+
["--navds-spacing-3", "--a-spacing-3"],
|
|
27
|
+
["--navds-spacing-2", "--a-spacing-2"],
|
|
28
|
+
["--navds-spacing-1", "--a-spacing-1"],
|
|
29
|
+
["--navds-global-color-purple-900", "--a-purple-900"],
|
|
30
|
+
["--navds-global-color-purple-800", "--a-purple-800"],
|
|
31
|
+
["--navds-global-color-purple-700", "--a-purple-700"],
|
|
32
|
+
["--navds-global-color-purple-600", "--a-purple-600"],
|
|
33
|
+
["--navds-global-color-purple-500", "--a-purple-500"],
|
|
34
|
+
["--navds-global-color-purple-400", "--a-purple-400"],
|
|
35
|
+
["--navds-global-color-purple-300", "--a-purple-300"],
|
|
36
|
+
["--navds-global-color-purple-200", "--a-purple-200"],
|
|
37
|
+
["--navds-global-color-purple-100", "--a-purple-100"],
|
|
38
|
+
["--navds-global-color-purple-50", "--a-purple-50"],
|
|
39
|
+
["--navds-global-color-orange-900", "--a-orange-900"],
|
|
40
|
+
["--navds-global-color-orange-800", "--a-orange-800"],
|
|
41
|
+
["--navds-global-color-orange-700", "--a-orange-700"],
|
|
42
|
+
["--navds-global-color-orange-600", "--a-orange-600"],
|
|
43
|
+
["--navds-global-color-orange-500", "--a-orange-500"],
|
|
44
|
+
["--navds-global-color-orange-400", "--a-orange-400"],
|
|
45
|
+
["--navds-global-color-orange-300", "--a-orange-300"],
|
|
46
|
+
["--navds-global-color-orange-200", "--a-orange-200"],
|
|
47
|
+
["--navds-global-color-orange-100", "--a-orange-100"],
|
|
48
|
+
["--navds-global-color-orange-50", "--a-orange-50"],
|
|
49
|
+
["--navds-global-color-limegreen-900", "--a-limegreen-900"],
|
|
50
|
+
["--navds-global-color-limegreen-800", "--a-limegreen-800"],
|
|
51
|
+
["--navds-global-color-limegreen-700", "--a-limegreen-700"],
|
|
52
|
+
["--navds-global-color-limegreen-600", "--a-limegreen-600"],
|
|
53
|
+
["--navds-global-color-limegreen-500", "--a-limegreen-500"],
|
|
54
|
+
["--navds-global-color-limegreen-400", "--a-limegreen-400"],
|
|
55
|
+
["--navds-global-color-limegreen-300", "--a-limegreen-300"],
|
|
56
|
+
["--navds-global-color-limegreen-200", "--a-limegreen-200"],
|
|
57
|
+
["--navds-global-color-limegreen-100", "--a-limegreen-100"],
|
|
58
|
+
["--navds-global-color-limegreen-50", "--a-limegreen-50"],
|
|
59
|
+
["--navds-global-color-lightblue-900", "--a-lightblue-900"],
|
|
60
|
+
["--navds-global-color-lightblue-800", "--a-lightblue-800"],
|
|
61
|
+
["--navds-global-color-lightblue-700", "--a-lightblue-700"],
|
|
62
|
+
["--navds-global-color-lightblue-600", "--a-lightblue-600"],
|
|
63
|
+
["--navds-global-color-lightblue-500", "--a-lightblue-500"],
|
|
64
|
+
["--navds-global-color-lightblue-400", "--a-lightblue-400"],
|
|
65
|
+
["--navds-global-color-lightblue-300", "--a-lightblue-300"],
|
|
66
|
+
["--navds-global-color-lightblue-200", "--a-lightblue-200"],
|
|
67
|
+
["--navds-global-color-lightblue-100", "--a-lightblue-100"],
|
|
68
|
+
["--navds-global-color-lightblue-50", "--a-lightblue-50"],
|
|
69
|
+
["--navds-global-color-green-900", "--a-green-900"],
|
|
70
|
+
["--navds-global-color-green-800", "--a-green-800"],
|
|
71
|
+
["--navds-global-color-green-700", "--a-green-700"],
|
|
72
|
+
["--navds-global-color-green-600", "--a-green-600"],
|
|
73
|
+
["--navds-global-color-green-500", "--a-green-500"],
|
|
74
|
+
["--navds-global-color-green-400", "--a-green-400"],
|
|
75
|
+
["--navds-global-color-green-300", "--a-green-300"],
|
|
76
|
+
["--navds-global-color-green-200", "--a-green-200"],
|
|
77
|
+
["--navds-global-color-green-100", "--a-green-100"],
|
|
78
|
+
["--navds-global-color-green-50", "--a-green-50"],
|
|
79
|
+
["--navds-global-color-deepblue-900", "--a-deepblue-900"],
|
|
80
|
+
["--navds-global-color-deepblue-800", "--a-deepblue-800"],
|
|
81
|
+
["--navds-global-color-deepblue-700", "--a-deepblue-700"],
|
|
82
|
+
["--navds-global-color-deepblue-600", "--a-deepblue-600"],
|
|
83
|
+
["--navds-global-color-deepblue-500", "--a-deepblue-500"],
|
|
84
|
+
["--navds-global-color-deepblue-400", "--a-deepblue-400"],
|
|
85
|
+
["--navds-global-color-deepblue-300", "--a-deepblue-300"],
|
|
86
|
+
["--navds-global-color-deepblue-200", "--a-deepblue-200"],
|
|
87
|
+
["--navds-global-color-deepblue-100", "--a-deepblue-100"],
|
|
88
|
+
["--navds-global-color-deepblue-50", "--a-deepblue-50"],
|
|
89
|
+
["--navds-global-color-red-900", "--a-red-900"],
|
|
90
|
+
["--navds-global-color-red-800", "--a-red-800"],
|
|
91
|
+
["--navds-global-color-red-700", "--a-red-700"],
|
|
92
|
+
["--navds-global-color-red-600", "--a-red-600"],
|
|
93
|
+
["--navds-global-color-red-500", "--a-red-500"],
|
|
94
|
+
["--navds-global-color-red-400", "--a-red-400"],
|
|
95
|
+
["--navds-global-color-red-300", "--a-red-300"],
|
|
96
|
+
["--navds-global-color-red-200", "--a-red-200"],
|
|
97
|
+
["--navds-global-color-red-100", "--a-red-100"],
|
|
98
|
+
["--navds-global-color-red-50", "--a-red-50"],
|
|
99
|
+
["--navds-global-color-blue-900", "--a-blue-900"],
|
|
100
|
+
["--navds-global-color-blue-800", "--a-blue-800"],
|
|
101
|
+
["--navds-global-color-blue-700", "--a-blue-700"],
|
|
102
|
+
["--navds-global-color-blue-600", "--a-blue-600"],
|
|
103
|
+
["--navds-global-color-blue-500", "--a-blue-500"],
|
|
104
|
+
["--navds-global-color-blue-400", "--a-blue-400"],
|
|
105
|
+
["--navds-global-color-blue-300", "--a-blue-300"],
|
|
106
|
+
["--navds-global-color-blue-200", "--a-blue-200"],
|
|
107
|
+
["--navds-global-color-blue-100", "--a-blue-100"],
|
|
108
|
+
["--navds-global-color-blue-50", "--a-blue-50"],
|
|
109
|
+
["--navds-global-color-gray-900", "--a-gray-900"],
|
|
110
|
+
["--navds-global-color-gray-800", "--a-gray-800"],
|
|
111
|
+
["--navds-global-color-gray-700", "--a-gray-700"],
|
|
112
|
+
["--navds-global-color-gray-600", "--a-gray-600"],
|
|
113
|
+
["--navds-global-color-gray-500", "--a-gray-500"],
|
|
114
|
+
["--navds-global-color-gray-400", "--a-gray-400"],
|
|
115
|
+
["--navds-global-color-gray-300", "--a-gray-300"],
|
|
116
|
+
["--navds-global-color-gray-200", "--a-gray-200"],
|
|
117
|
+
["--navds-global-color-gray-100", "--a-gray-100"],
|
|
118
|
+
["--navds-global-color-gray-50", "--a-gray-50"],
|
|
119
|
+
["--navds-global-color-nav-red", "--a-nav-red"],
|
|
120
|
+
["--navds-global-color-white", "--a-white"],
|
|
121
|
+
["--navds-global-color-transparent", "--a-transparent"],
|
|
122
|
+
["--navds-border-radius-full", "--a-border-radius-full"],
|
|
123
|
+
["--navds-border-radius-xlarge", "--a-border-radius-xlarge"],
|
|
124
|
+
["--navds-border-radius-large", "--a-border-radius-large"],
|
|
125
|
+
["--navds-border-radius-medium", "--a-border-radius-medium"],
|
|
126
|
+
["--navds-border-radius-small", "--a-border-radius-small"],
|
|
127
|
+
["--navds-z-index-tooltip", "--a-z-index-tooltip"],
|
|
128
|
+
["--navds-z-index-focus", "--a-z-index-focus"],
|
|
129
|
+
["--navds-z-index-popover", "--a-z-index-popover"],
|
|
130
|
+
["--navds-z-index-modal", "--a-z-index-modal"],
|
|
131
|
+
["--navds-font-weight-regular", "--a-font-weight-regular"],
|
|
132
|
+
["--navds-font-weight-bold", "--a-font-weight-bold"],
|
|
133
|
+
["--navds-font-size-small", "--a-font-size-small"],
|
|
134
|
+
["--navds-font-size-medium", "--a-font-size-medium"],
|
|
135
|
+
["--navds-font-size-large", "--a-font-size-large"],
|
|
136
|
+
["--navds-font-size-xlarge", "--a-font-size-xlarge"],
|
|
137
|
+
["--navds-font-size-heading-xsmall", "--a-font-size-heading-xsmall"],
|
|
138
|
+
["--navds-font-size-heading-small", "--a-font-size-heading-small"],
|
|
139
|
+
["--navds-font-size-heading-medium", "--a-font-size-heading-medium"],
|
|
140
|
+
["--navds-font-size-heading-large", "--a-font-size-heading-large"],
|
|
141
|
+
["--navds-font-size-heading-xlarge", "--a-font-size-heading-xlarge"],
|
|
142
|
+
["--navds-font-size-heading-2xlarge", "--a-font-size-heading-2xlarge"],
|
|
143
|
+
["--navds-font-line-height-medium", "--a-font-line-height-medium"],
|
|
144
|
+
["--navds-font-line-height-large", "--a-font-line-height-large"],
|
|
145
|
+
["--navds-font-line-height-xlarge", "--a-font-line-height-xlarge"],
|
|
146
|
+
["--navds-font-line-height-heading-xsmall", "--a-font-line-height-heading-xsmall"],
|
|
147
|
+
["--navds-font-line-height-heading-small", "--a-font-line-height-heading-small"],
|
|
148
|
+
["--navds-font-line-height-heading-medium", "--a-font-line-height-heading-medium"],
|
|
149
|
+
["--navds-font-line-height-heading-large", "--a-font-line-height-heading-large"],
|
|
150
|
+
["--navds-font-line-height-heading-xlarge", "--a-font-line-height-heading-xlarge"],
|
|
151
|
+
["--navds-font-line-height-heading-2xlarge", "--a-font-line-height-heading-2xlarge"],
|
|
152
|
+
["--navds-font-family", "--a-font-family"],
|
|
153
|
+
["--navds-semantic-color-feedback-info-icon", "--a-icon-info"],
|
|
154
|
+
["--navds-semantic-color-feedback-warning-icon", "--a-icon-warning"],
|
|
155
|
+
["--navds-semantic-color-feedback-danger-icon", "--a-icon-danger"],
|
|
156
|
+
["--navds-semantic-color-feedback-success-icon", "--a-icon-success"],
|
|
157
|
+
["--navds-semantic-color-feedback-info-background", "--a-surface-info-subtle"],
|
|
158
|
+
["--navds-semantic-color-feedback-warning-background", "--a-surface-warning-subtle"],
|
|
159
|
+
["--navds-semantic-color-interaction-danger-selected", "--a-surface-danger-active"],
|
|
160
|
+
["--navds-semantic-color-interaction-danger-hover", "--a-surface-danger-hover"],
|
|
161
|
+
["--navds-semantic-color-interaction-danger", "--a-surface-danger"],
|
|
162
|
+
["--navds-semantic-color-feedback-danger-background", "--a-surface-danger-subtle"],
|
|
163
|
+
["--navds-semantic-color-feedback-success-background", "--a-surface-success-subtle"],
|
|
164
|
+
["--navds-semantic-color-interaction-primary-hover-subtle", "--a-surface-action-subtle-hover"],
|
|
165
|
+
["--navds-semantic-color-interaction-primary-selected", "--a-surface-action-selected"],
|
|
166
|
+
["--navds-semantic-color-interaction-primary-hover", "--a-surface-action-hover"],
|
|
167
|
+
["--navds-semantic-color-interaction-primary", "--a-surface-action"],
|
|
168
|
+
["--navds-semantic-color-canvas-background-inverted", "--a-surface-inverted"],
|
|
169
|
+
["--navds-semantic-color-component-background-inverted", "--a-surface-inverted"],
|
|
170
|
+
["--navds-semantic-color-component-background-alternate", "--a-surface-subtle"],
|
|
171
|
+
["--navds-semantic-color-component-background-light", "--a-surface-default"],
|
|
172
|
+
["--navds-semantic-color-canvas-background-light", "--a-bg-default"],
|
|
173
|
+
["--navds-semantic-color-canvas-background", "--a-bg-subtle"],
|
|
174
|
+
["--navds-semantic-color-border-inverted", "--a-border-on-inverted"],
|
|
175
|
+
["--navds-semantic-color-border-muted", "--a-border-default"],
|
|
176
|
+
["--navds-semantic-color-border", "--a-border-strong"],
|
|
177
|
+
["--navds-semantic-color-focus-inverted", "--a-border-focus-on-inverted"],
|
|
178
|
+
["--navds-semantic-color-focus", "--a-border-focus"],
|
|
179
|
+
["--navds-semantic-color-feedback-info-border", "--a-border-info"],
|
|
180
|
+
["--navds-semantic-color-feedback-warning-border", "--a-border-warning"],
|
|
181
|
+
["--navds-semantic-color-feedback-danger-border", "--a-border-danger"],
|
|
182
|
+
["--navds-semantic-color-feedback-success-border", "--a-border-success"],
|
|
183
|
+
["--navds-semantic-color-divider", "--a-border-divider"],
|
|
184
|
+
["--navds-shadow-focus-inverted", "--a-shadow-focus-inverted"],
|
|
185
|
+
["--navds-shadow-focus", "--a-shadow-focus"],
|
|
186
|
+
["--navds-shadow-xsmall", "--a-shadow-xsmall"],
|
|
187
|
+
["--navds-shadow-small", "--a-shadow-small"],
|
|
188
|
+
["--navds-shadow-medium", "--a-shadow-medium"],
|
|
189
|
+
["--navds-shadow-large", "--a-shadow-large"],
|
|
190
|
+
["--navds-shadow-xlarge", "--a-shadow-xlarge"],
|
|
191
|
+
/* Components */
|
|
192
|
+
["--navds-modal-color-overlay", "--a-surface-backdrop"],
|
|
193
|
+
["--navds-accordion-color-border", "--a-border-strong"],
|
|
194
|
+
["--navds-accordion-color-text-hover", "--a-surface-action"],
|
|
195
|
+
["--navds-accordion-color-border-hover", "--a-surface-action"],
|
|
196
|
+
["--navds-accordion-color-background-open", "--a-surface-action-subtle"],
|
|
197
|
+
["--navds-alert-color-error-border", "--a-border-danger"],
|
|
198
|
+
["--navds-alert-color-error-background", "--a-surface-danger-subtle"],
|
|
199
|
+
["--navds-alert-color-warning-border", "--a-border-warning"],
|
|
200
|
+
["--navds-alert-color-warning-background", "--a-surface-warning-subtle"],
|
|
201
|
+
["--navds-alert-color-info-border", "--a-border-info"],
|
|
202
|
+
["--navds-alert-color-info-background", "--a-surface-info-subtle"],
|
|
203
|
+
["--navds-alert-color-success-border", "--a-border-success"],
|
|
204
|
+
["--navds-alert-color-success-background", "--a-surface-success-subtle"],
|
|
205
|
+
["--navds-alert-color-border", "--a-border-default"],
|
|
206
|
+
["--navds-chat-color-avatar-background", "--a-bg-subtle"],
|
|
207
|
+
["--navds-chat-color-background", "--a-bg-subtle"],
|
|
208
|
+
["--navds-chat-color-avatar", "--a-text-default"],
|
|
209
|
+
["--navds-guide-panel-color-illustration-background", "--a-surface-action-subtle"],
|
|
210
|
+
["--navds-guide-panel-color-background", "--a-surface-default"],
|
|
211
|
+
["--navds-guide-panel-color-border", "--a-border-action"],
|
|
212
|
+
["--navds-error-summary-color-background", "--a-surface-default"],
|
|
213
|
+
["--navds-error-summary-color-border", "--a-border-danger"],
|
|
214
|
+
["--navds-confirmation-panel-color-background-checked", "--a-surface-success-subtle"],
|
|
215
|
+
["--navds-confirmation-panel-color-background-error", "--a-surface-danger-subtle"],
|
|
216
|
+
["--navds-confirmation-panel-color-border-checked", "--a-border-success"],
|
|
217
|
+
["--navds-confirmation-panel-color-border-error", "--a-border-danger"],
|
|
218
|
+
["--navds-confirmation-panel-color-background", "--a-surface-warning-subtle"],
|
|
219
|
+
["--navds-confirmation-panel-color-border", "--a-border-warning"],
|
|
220
|
+
["--navds-radio-checkbox-color-background-hover", "--a-surface-action-subtle"],
|
|
221
|
+
["--navds-radio-checkbox-color-background-checked", "--a-surface-action"],
|
|
222
|
+
["--navds-radio-checkbox-color-shadow-hover", "--a-surface-action"],
|
|
223
|
+
["--navds-radio-checkbox-color-shadow-checked", "--a-surface-action"],
|
|
224
|
+
["--navds-radio-checkbox-color-shadow-error", "--a-surface-danger"],
|
|
225
|
+
["--navds-radio-checkbox-color-label-hover", "--a-surface-action"],
|
|
226
|
+
["--navds-radio-checkbox-color-background", "--a-surface-default"],
|
|
227
|
+
["--navds-radio-checkbox-color-text", "--a-text-default"],
|
|
228
|
+
["--navds-radio-checkbox-color-shadow", "--a-border-strong"],
|
|
229
|
+
["--navds-select-color-border-hover", "--a-surface-action"],
|
|
230
|
+
["--navds-select-color-border-error", "--a-surface-danger"],
|
|
231
|
+
["--navds-select-color-shadow-error", "--a-surface-danger"],
|
|
232
|
+
["--navds-select-color-border-disabled", "--a-gray-400"],
|
|
233
|
+
["--navds-select-color-background-disabled", "--a-surface-subtle"],
|
|
234
|
+
["--navds-switch-color-label-hover", "--a-surface-action"],
|
|
235
|
+
["--navds-select-color-background", "--a-surface-default"],
|
|
236
|
+
["--navds-select-color-border", "--a-border-strong"],
|
|
237
|
+
["--navds-switch-color-label", "--a-text-default"],
|
|
238
|
+
["--navds-switch-color-track-background-hover-checked", "--a-icon-success"],
|
|
239
|
+
["--navds-switch-color-track-shadow-inner-focus", "--a-surface-default"],
|
|
240
|
+
["--navds-switch-color-track-background-checked", "--a-border-success"],
|
|
241
|
+
["--navds-switch-color-track-background-hover", "--a-surface-neutral-hover"],
|
|
242
|
+
["--navds-switch-color-track-background", "--a-surface-neutral"],
|
|
243
|
+
["--navds-switch-color-thumb-icon-checked", "--a-border-success"],
|
|
244
|
+
["--navds-switch-color-thumb-loader-checked", "--a-border-success"],
|
|
245
|
+
["--navds-switch-color-thumb-icon", "--a-icon-subtle"],
|
|
246
|
+
["--navds-switch-color-thumb", "--a-surface-default"],
|
|
247
|
+
["--navds-textarea-color-counter-text-error", "--a-surface-danger"],
|
|
248
|
+
["--navds-textarea-color-border-hover", "--a-surface-action"],
|
|
249
|
+
["--navds-textarea-color-border-error", "--a-surface-danger"],
|
|
250
|
+
["--navds-textarea-color-shadow-error", "--a-surface-danger"],
|
|
251
|
+
["--navds-textarea-color-counter-text", "--a-text-subtle"],
|
|
252
|
+
["--navds-textarea-color-text-disabled", "--a-text-default"],
|
|
253
|
+
["--navds-textarea-color-border-disabled", "--a-gray-400"],
|
|
254
|
+
["--navds-textarea-color-background-disabled", "--a-surface-subtle"],
|
|
255
|
+
["--navds-textarea-color-background", "--a-surface-default"],
|
|
256
|
+
["--navds-textarea-color-border", "--a-border-strong"],
|
|
257
|
+
["--navds-help-text-color-popover-background", "--a-surface-info-subtle"],
|
|
258
|
+
["--navds-help-text-color-background-hover", "--a-surface-action"],
|
|
259
|
+
["--navds-help-text-color-background-focus", "--a-surface-action"],
|
|
260
|
+
["--navds-help-text-color-shadow-hover", "--a-surface-action"],
|
|
261
|
+
["--navds-help-text-color-hover", "--a-surface-default"],
|
|
262
|
+
["--navds-help-text-color-focus", "--a-surface-default"],
|
|
263
|
+
["--navds-help-text-color", "--a-surface-action"],
|
|
264
|
+
["--navds-link-color-text-focus", "--a-text-on-action"],
|
|
265
|
+
["--navds-link-color-text-active", "--a-text-on-action"],
|
|
266
|
+
["--navds-link-color-text", "--a-text-action"],
|
|
267
|
+
["--navds-link-color-icon", "--a-icon-action"],
|
|
268
|
+
["--navds-link-color-icon-focus", "--a-icon-on-action"],
|
|
269
|
+
["--navds-link-color-background-focus", "--a-border-focus"],
|
|
270
|
+
["--navds-link-color-background-active", "--a-border-focus"],
|
|
271
|
+
["--navds-link-color-on-info-background", "--a-text-default"],
|
|
272
|
+
["--navds-link-color-on-error-background", "--a-text-default"],
|
|
273
|
+
["--navds-loader-color-neutral-foreground", "--a-border-default"],
|
|
274
|
+
["--navds-loader-color-interaction-foreground", "--a-surface-action"],
|
|
275
|
+
["--navds-loader-color-inverted-foreground", "--a-surface-default"],
|
|
276
|
+
["--navds-loader-color-transparent-background", "--a-surface-transparent"],
|
|
277
|
+
["--navds-loader-color-foreground", "--a-border-default"],
|
|
278
|
+
["--navds-loader-color-background", "--a-surface-active"],
|
|
279
|
+
["--navds-modal-color-background", "--a-surface-default"],
|
|
280
|
+
["--navds-pagination-color-text-selected", "--a-text-on-action"],
|
|
281
|
+
["--navds-pagination-color-background-selected", "--a-surface-action-selected"],
|
|
282
|
+
["--navds-popover-color-background", "--a-surface-default"],
|
|
283
|
+
["--navds-popover-color-border", "--a-border-default"],
|
|
284
|
+
["--navds-tag-color-info-background", "--a-surface-info-subtle"],
|
|
285
|
+
["--navds-tag-color-info-border", "--a-border-info"],
|
|
286
|
+
["--navds-tag-color-warning-background", "--a-surface-warning-subtle"],
|
|
287
|
+
["--navds-tag-color-warning-border", "--a-border-warning"],
|
|
288
|
+
["--navds-tag-color-success-background", "--a-surface-success-subtle"],
|
|
289
|
+
["--navds-tag-color-success-border", "--a-border-success"],
|
|
290
|
+
["--navds-tag-color-error-background", "--a-surface-danger-subtle"],
|
|
291
|
+
["--navds-tag-color-error-border", "--a-border-danger"],
|
|
292
|
+
["--navds-tag-color-border", "--a-border-default"],
|
|
293
|
+
["--navds-tag-color-background", "--a-surface-subtle"],
|
|
294
|
+
["--navds-toggle-group-color-background-hover", "--a-surface-action-subtle"],
|
|
295
|
+
["--navds-toggle-group-color-text-hover", "--a-surface-action"],
|
|
296
|
+
["--navds-toggle-group-color-background-pressed", "--a-surface-action-selected"],
|
|
297
|
+
["--navds-toggle-group-color-text-pressed", "--a-text-on-action"],
|
|
298
|
+
["--navds-toggle-group-color-background", "--a-surface-default"],
|
|
299
|
+
["--navds-toggle-group-color-text", "--a-text-default"],
|
|
300
|
+
["--navds-toggle-group-color-border", "--a-border-divider"],
|
|
301
|
+
["--navds-panel-color-background", "--a-surface-default"],
|
|
302
|
+
["--navds-panel-color-border", "--a-border-default"],
|
|
303
|
+
["--navds-link-panel-color-border-hover", "--a-surface-action"],
|
|
304
|
+
["--navds-link-panel-color-title-hover", "--a-text-action"],
|
|
305
|
+
["--navds-link-panel-color-text", "--a-text-default"],
|
|
306
|
+
["--navds-table-row-color-background-selected-hover", "--a-surface-action-subtle-hover"],
|
|
307
|
+
["--navds-table-row-color-background-hover", "--a-bg-subtle"],
|
|
308
|
+
["--navds-table-row-color-background-selected", "--a-surface-action-subtle"],
|
|
309
|
+
["--navds-table-row-color-background-zebra", "--a-surface-subtle"],
|
|
310
|
+
["--navds-table-cell-color-border-hover", "--a-border-strong"],
|
|
311
|
+
["--navds-table-cell-color-border", "--a-border-default"],
|
|
312
|
+
["--navds-button-color-primary-background-hover", "--a-surface-action-hover"],
|
|
313
|
+
["--navds-button-color-primary-background-active", "--a-surface-action-active"],
|
|
314
|
+
["--navds-button-color-primary-border-focus", "--a-surface-default"],
|
|
315
|
+
["--navds-button-color-primary-text", "--a-text-on-action"],
|
|
316
|
+
["--navds-button-color-primary-background", "--a-surface-action"],
|
|
317
|
+
["--navds-button-color-secondary-border-focus-active-hover", "--a-surface-default"],
|
|
318
|
+
["--navds-button-color-secondary-text-hover", "--a-text-action"],
|
|
319
|
+
["--navds-button-color-secondary-text-active", "--a-text-on-action"],
|
|
320
|
+
["--navds-button-color-secondary-background-hover", "--a-surface-action-subtle-hover"],
|
|
321
|
+
["--navds-button-color-secondary-background-active", "--a-surface-action-active"],
|
|
322
|
+
["--navds-button-color-secondary-border", "--a-border-action"],
|
|
323
|
+
["--navds-button-color-secondary-text", "--a-text-action"],
|
|
324
|
+
["--navds-button-color-secondary-background", "--a-surface-default"],
|
|
325
|
+
["--navds-button-color-tertiary-background-hover", "--a-surface-action-subtle-hover"],
|
|
326
|
+
["--navds-button-color-tertiary-border-focus", "--a-border-action"],
|
|
327
|
+
["--navds-button-color-tertiary-border-active", "--a-surface-default"],
|
|
328
|
+
["--navds-button-color-tertiary-background-active", "--a-surface-action-active"],
|
|
329
|
+
["--navds-button-color-tertiary-text-active", "--a-text-on-action"],
|
|
330
|
+
["--navds-button-color-tertiary-text", "--a-text-action"],
|
|
331
|
+
["--navds-button-color-danger-background-hover", "--a-surface-danger-hover"],
|
|
332
|
+
["--navds-button-color-danger-background-active", "--a-surface-danger-active"],
|
|
333
|
+
["--navds-button-color-danger-border-focus", "--a-surface-default"],
|
|
334
|
+
["--navds-button-color-danger-background", "--a-surface-danger"],
|
|
335
|
+
["--navds-button-color-danger-text", "--a-text-on-danger"],
|
|
336
|
+
["--navds-error-message-color-text", "--a-text-danger"],
|
|
337
|
+
["--navds-search-color-border-hover", "--a-border-action"],
|
|
338
|
+
["--navds-search-color-clear-hover", "--a-text-action"],
|
|
339
|
+
["--navds-search-color-border-error", "--a-border-danger"],
|
|
340
|
+
["--navds-search-color-text", "--a-text-default"],
|
|
341
|
+
["--navds-search-color-border", "--a-border-default"],
|
|
342
|
+
["--navds-text-field-color-border-hover", "--a-border-action"],
|
|
343
|
+
["--navds-text-field-color-border-error", "--a-border-danger"],
|
|
344
|
+
["--navds-text-field-color-shadow-error", "--a-border-danger"],
|
|
345
|
+
["--navds-text-field-color-border-disabled", "--a-gray-400"],
|
|
346
|
+
["--navds-text-field-color-background-disabled", "--a-surface-subtle"],
|
|
347
|
+
["--navds-text-field-color-placeholder-text", "--a-text-subtle"],
|
|
348
|
+
["--navds-text-field-color-text-disabled", "--a-text-default"],
|
|
349
|
+
["--navds-text-field-color-text", "--a-text-default"],
|
|
350
|
+
["--navds-text-field-color-background", "--a-surface-default"],
|
|
351
|
+
["--navds-text-field-color-border", "--a-border-default"],
|
|
352
|
+
["--navds-dropdown-menu-color", "--a-text-default"],
|
|
353
|
+
["--navdsi-dropdown-item-color-text", "--a-text-action"],
|
|
354
|
+
["--navdsi-dropdown-item-color-background-hover", "--a-surface-action-subtle-hover"],
|
|
355
|
+
["--navdsi-dropdown-item-color-background-active", "--a-surface-action-active"],
|
|
356
|
+
["--navds-dropdown-item-color-focus", "--a-border-focus"],
|
|
357
|
+
["--navdsi-header-color-text", "--a-text-on-inverted"],
|
|
358
|
+
["--navdsi-header-color-background", "--a-surface-inverted"],
|
|
359
|
+
["--navdsi-header-color-border", "--a-gray-600"],
|
|
360
|
+
["--navdsi-header-color-hover", "--a-surface-inverted-hover"],
|
|
361
|
+
["--navdsi-header-color-active", "--a-surface-inverted-active"],
|
|
362
|
+
["--navds-button-icon-adjustment", "--ac-button-icon-margin"]
|
|
363
|
+
];
|
|
364
|
+
module.exports = { tokens };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const rename_props_1 = __importDefault(require("../../utils/rename-props"));
|
|
7
|
+
/**
|
|
8
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
9
|
+
* @param {import('jscodeshift').API} api
|
|
10
|
+
*/
|
|
11
|
+
function transformer(file, api, options) {
|
|
12
|
+
const j = api.jscodeshift;
|
|
13
|
+
const root = j(file.source);
|
|
14
|
+
const printOptions = options.printOptions;
|
|
15
|
+
return (0, rename_props_1.default)({
|
|
16
|
+
root,
|
|
17
|
+
componentName: options.component,
|
|
18
|
+
props: { [options.from]: options.to },
|
|
19
|
+
}).toSource(printOptions);
|
|
20
|
+
}
|
|
21
|
+
exports.default = transformer;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const rename_props_1 = __importDefault(require("../../../utils/rename-props"));
|
|
7
|
+
/**
|
|
8
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
9
|
+
* @param {import('jscodeshift').API} api
|
|
10
|
+
*/
|
|
11
|
+
function transformer(file, api, options) {
|
|
12
|
+
const j = api.jscodeshift;
|
|
13
|
+
let localName = "SpeechBubble";
|
|
14
|
+
const root = j(file.source);
|
|
15
|
+
/* Finds and replaces import from SpeechBubble -> Chat */
|
|
16
|
+
root
|
|
17
|
+
.find(j.ImportDeclaration)
|
|
18
|
+
.filter((path) => path.node.source.value === "@navikt/ds-react")
|
|
19
|
+
.forEach((imp) => {
|
|
20
|
+
imp.value.specifiers.forEach((x) => {
|
|
21
|
+
if (x.imported.name === "SpeechBubble") {
|
|
22
|
+
if (x.local.name !== x.imported.name) {
|
|
23
|
+
localName = x.local.name;
|
|
24
|
+
x.imported.name = "Chat";
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
x.imported.name = "Chat";
|
|
28
|
+
x.local.name = "Chat";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
if (j(file.source).findJSXElements(localName)) {
|
|
34
|
+
(0, rename_props_1.default)({
|
|
35
|
+
root,
|
|
36
|
+
componentName: localName,
|
|
37
|
+
props: {
|
|
38
|
+
illustrationBgColor: "avatarBgColor",
|
|
39
|
+
illustration: "avatar",
|
|
40
|
+
topText: "name",
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
/* Find and replace name of all <SpeechBubble />*/
|
|
44
|
+
const compRoot = root.find(j.JSXElement, {
|
|
45
|
+
openingElement: { name: { name: localName } },
|
|
46
|
+
});
|
|
47
|
+
compRoot.forEach((x) => {
|
|
48
|
+
if (localName !== "SpeechBubble")
|
|
49
|
+
return;
|
|
50
|
+
x.node.openingElement.name.name = "Chat";
|
|
51
|
+
x.node.closingElement.name.name = "Chat";
|
|
52
|
+
});
|
|
53
|
+
/* Need to handle dot-notations differently */
|
|
54
|
+
const child = root.find(j.JSXElement);
|
|
55
|
+
child.forEach((x) => {
|
|
56
|
+
if (x.value.openingElement.name.type === "JSXMemberExpression" &&
|
|
57
|
+
x.value.openingElement.name.object.name === "SpeechBubble") {
|
|
58
|
+
x.value.openingElement.name.object.name = "Chat";
|
|
59
|
+
x.value.closingElement.name.object.name = "Chat";
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return root.toSource(options.printOptions);
|
|
64
|
+
}
|
|
65
|
+
exports.default = transformer;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
5
|
+
* @param {import('jscodeshift').API} api
|
|
6
|
+
*/
|
|
7
|
+
function transformer(file, api, options) {
|
|
8
|
+
const j = api.jscodeshift;
|
|
9
|
+
let localName = "Pagination";
|
|
10
|
+
const root = j(file.source);
|
|
11
|
+
function addMigrationTag(node) {
|
|
12
|
+
const attributes = node.openingElement.attributes;
|
|
13
|
+
const isMigrated = attributes.find((node) => node.type === "JSXAttribute" &&
|
|
14
|
+
node.name.name === "data-version" &&
|
|
15
|
+
node.value.value === "v1");
|
|
16
|
+
if (!isMigrated) {
|
|
17
|
+
attributes.push(j.jsxAttribute(j.jsxIdentifier("data-version"), j.literal("v1")));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/* https://github.com/mui/material-ui/blob/master/packages/mui-codemod/src/v5.0.0/variant-prop.js */
|
|
21
|
+
function addExplicitStandardProp(node) {
|
|
22
|
+
const attributes = node.openingElement.attributes;
|
|
23
|
+
const variant = attributes.find((node) => node.type === "JSXAttribute" && node.name.name === "size");
|
|
24
|
+
if (!variant) {
|
|
25
|
+
attributes.unshift(j.jsxAttribute(j.jsxIdentifier("size"), j.literal("small")));
|
|
26
|
+
addMigrationTag(node);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/* Finds locally used name for Pagination */
|
|
30
|
+
root
|
|
31
|
+
.find(j.ImportDeclaration)
|
|
32
|
+
.filter((path) => path.node.source.value === "@navikt/ds-react")
|
|
33
|
+
.forEach((imp) => {
|
|
34
|
+
imp.value.specifiers.forEach((x) => {
|
|
35
|
+
if (x.imported.name === "Pagination" &&
|
|
36
|
+
x.local.name !== x.imported.name) {
|
|
37
|
+
localName = x.local.name;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
if (j(file.source).findJSXElements(localName)) {
|
|
42
|
+
root.findJSXElements(`${localName}`).forEach((parent) => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const skip = !!((_a = parent.value.openingElement) === null || _a === void 0 ? void 0 : _a.attributes.find((x) => x.name.name === "data-version" && x.value.value === "v1"));
|
|
45
|
+
(_b = parent.value.openingElement) === null || _b === void 0 ? void 0 : _b.attributes.forEach((x, index) => {
|
|
46
|
+
var _a;
|
|
47
|
+
let didUpdate = false;
|
|
48
|
+
if (((_a = x.name) === null || _a === void 0 ? void 0 : _a.name) === "size" && x.type === "JSXAttribute" && !skip) {
|
|
49
|
+
/* addExplicitStandardProp */
|
|
50
|
+
if (x.value.value === "medium") {
|
|
51
|
+
x.value = j.literal("small");
|
|
52
|
+
didUpdate = true;
|
|
53
|
+
}
|
|
54
|
+
else if (x.value.value === "small") {
|
|
55
|
+
x.value = j.literal("xsmall");
|
|
56
|
+
didUpdate = true;
|
|
57
|
+
}
|
|
58
|
+
didUpdate && addMigrationTag(parent.value);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
addExplicitStandardProp(parent.value);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return root.toSource(options.printOptions);
|
|
65
|
+
}
|
|
66
|
+
exports.default = transformer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const tabs_1 = __importDefault(require("../tabs/tabs"));
|
|
7
|
+
const chat_1 = __importDefault(require("../chat/chat"));
|
|
8
|
+
const pagination_1 = __importDefault(require("../pagination/pagination"));
|
|
9
|
+
/**
|
|
10
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
11
|
+
* @param {import('jscodeshift').API} api
|
|
12
|
+
*/
|
|
13
|
+
function transformer(file, api, options) {
|
|
14
|
+
file.source = (0, tabs_1.default)(file, api, options);
|
|
15
|
+
file.source = (0, chat_1.default)(file, api, options);
|
|
16
|
+
file.source = (0, pagination_1.default)(file, api, options);
|
|
17
|
+
return file.source;
|
|
18
|
+
}
|
|
19
|
+
exports.default = transformer;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const rename_props_1 = __importDefault(require("../../../utils/rename-props"));
|
|
7
|
+
/**
|
|
8
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
9
|
+
* @param {import('jscodeshift').API} api
|
|
10
|
+
*/
|
|
11
|
+
function transformer(file, api, options) {
|
|
12
|
+
const j = api.jscodeshift;
|
|
13
|
+
let localName = "Tabs";
|
|
14
|
+
let iconPositionProp = null;
|
|
15
|
+
const root = j(file.source);
|
|
16
|
+
/* Finds used name for Tabs component */
|
|
17
|
+
root
|
|
18
|
+
.find(j.ImportDeclaration)
|
|
19
|
+
.filter((path) => path.node.source.value === "@navikt/ds-react")
|
|
20
|
+
.forEach((imp) => {
|
|
21
|
+
imp.value.specifiers.forEach((x) => {
|
|
22
|
+
if (x.imported.name === "Tabs" && x.local.name !== x.imported.name) {
|
|
23
|
+
localName = x.local.name;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
if (j(file.source).findJSXElements(localName)) {
|
|
28
|
+
(0, rename_props_1.default)({
|
|
29
|
+
root,
|
|
30
|
+
componentName: `${localName}.List`,
|
|
31
|
+
props: {
|
|
32
|
+
loop: "null",
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
root.findJSXElements(`${localName}`).forEach((parent) => {
|
|
36
|
+
parent.value.children.forEach((el) => {
|
|
37
|
+
const openingEl = el.openingElement;
|
|
38
|
+
if ((openingEl === null || openingEl === void 0 ? void 0 : openingEl.name) && openingEl.name.type === "JSXMemberExpression") {
|
|
39
|
+
if (openingEl.name.object.name === localName &&
|
|
40
|
+
openingEl.name.property.name === "List") {
|
|
41
|
+
/* Move loop-prop */
|
|
42
|
+
el.openingElement.attributes.forEach((x, index) => {
|
|
43
|
+
var _a;
|
|
44
|
+
if (((_a = x.name) === null || _a === void 0 ? void 0 : _a.name) === "loop" && x.type === "JSXAttribute") {
|
|
45
|
+
parent.value.openingElement.attributes.push(x);
|
|
46
|
+
delete el.openingElement.attributes[index];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
/* Find and move iconPosition-prop to <Tabs/> */
|
|
50
|
+
el.children.forEach((tab) => {
|
|
51
|
+
const tabEl = tab.openingElement;
|
|
52
|
+
if ((tabEl === null || tabEl === void 0 ? void 0 : tabEl.name) && tabEl.name.type === "JSXMemberExpression") {
|
|
53
|
+
if (tabEl.name.object.name === localName &&
|
|
54
|
+
tabEl.name.property.name === "Tab") {
|
|
55
|
+
tabEl === null || tabEl === void 0 ? void 0 : tabEl.attributes.forEach((x, index) => {
|
|
56
|
+
var _a;
|
|
57
|
+
if (((_a = x.name) === null || _a === void 0 ? void 0 : _a.name) === "iconPosition" &&
|
|
58
|
+
x.type === "JSXAttribute") {
|
|
59
|
+
if (!iconPositionProp) {
|
|
60
|
+
iconPositionProp = x;
|
|
61
|
+
}
|
|
62
|
+
delete tabEl.attributes[index];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
iconPositionProp &&
|
|
72
|
+
parent.value.openingElement.attributes.push(iconPositionProp);
|
|
73
|
+
iconPositionProp = null;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return root.toSource(options.printOptions);
|
|
77
|
+
}
|
|
78
|
+
exports.default = transformer;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tokens_map_mjs_1 = require("../../../tokens-map.mjs");
|
|
4
|
+
/**
|
|
5
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
6
|
+
* @param {import('jscodeshift').API} api
|
|
7
|
+
*/
|
|
8
|
+
function transformer(file, api) {
|
|
9
|
+
let src = file.source;
|
|
10
|
+
tokens_map_mjs_1.tokens.forEach((tok) => {
|
|
11
|
+
// eslint-disable-next-line no-useless-concat
|
|
12
|
+
const rgx = new RegExp("(" + `${tok[0]}:` + ")", "gm");
|
|
13
|
+
src = src.replace(rgx, `--v2-migration${tok[0].replace("--", "__")}:`);
|
|
14
|
+
});
|
|
15
|
+
tokens_map_mjs_1.tokens.forEach((tok) => {
|
|
16
|
+
const rgx = new RegExp("(" + tok[0] + ")", "gm");
|
|
17
|
+
src = src.replace(rgx, tok[1]);
|
|
18
|
+
});
|
|
19
|
+
return src;
|
|
20
|
+
}
|
|
21
|
+
exports.default = transformer;
|