@tamagui/static 1.132.14 → 1.132.16-1754534218765
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/extractor/createExtractor.js +44 -107
- package/dist/extractor/createExtractor.js.map +1 -1
- package/dist/extractor/createExtractor.native.js +52 -112
- package/dist/extractor/createExtractor.native.js.map +2 -2
- package/dist/extractor/extractMediaStyle.js +1 -1
- package/dist/extractor/extractMediaStyle.js.map +1 -1
- package/dist/extractor/extractMediaStyle.native.js +1 -1
- package/dist/extractor/extractMediaStyle.native.js.map +2 -2
- package/dist/extractor/extractToClassNames.js +184 -168
- package/dist/extractor/extractToClassNames.js.map +2 -2
- package/dist/extractor/extractToClassNames.native.js +185 -186
- package/dist/extractor/extractToClassNames.native.js.map +2 -2
- package/dist/extractor/extractToNative.js +47 -78
- package/dist/extractor/extractToNative.js.map +1 -1
- package/dist/extractor/extractToNative.native.js +23 -39
- package/dist/extractor/extractToNative.native.js.map +2 -2
- package/dist/extractor/normalizeTernaries.js +5 -2
- package/dist/extractor/normalizeTernaries.js.map +1 -1
- package/dist/extractor/normalizeTernaries.native.js +2 -2
- package/dist/extractor/normalizeTernaries.native.js.map +2 -2
- package/dist/registerRequire.js +1 -1
- package/dist/registerRequire.js.map +1 -1
- package/dist/registerRequire.native.js +1 -1
- package/dist/registerRequire.native.js.map +1 -1
- package/dist/types.native.js.map +1 -1
- package/package.json +15 -15
- package/src/extractor/createExtractor.ts +74 -172
- package/src/extractor/extractMediaStyle.ts +1 -1
- package/src/extractor/extractToClassNames.ts +334 -260
- package/src/extractor/extractToNative.ts +68 -111
- package/src/extractor/normalizeTernaries.ts +7 -3
- package/src/registerRequire.ts +1 -1
- package/src/types.ts +9 -13
- package/types/extractor/createExtractor.d.ts.map +1 -1
- package/types/extractor/extractToClassNames.d.ts.map +1 -1
- package/types/extractor/extractToNative.d.ts.map +1 -1
- package/types/extractor/normalizeTernaries.d.ts.map +1 -1
- package/types/types.d.ts +8 -10
- package/types/types.d.ts.map +1 -1
- package/dist/extractor/buildClassName.js +0 -72
- package/dist/extractor/buildClassName.js.map +0 -6
- package/dist/extractor/buildClassName.native.js +0 -67
- package/dist/extractor/buildClassName.native.js.map +0 -6
- package/dist/extractor/ensureImportingConcat.js +0 -50
- package/dist/extractor/ensureImportingConcat.js.map +0 -6
- package/dist/extractor/ensureImportingConcat.native.js +0 -49
- package/dist/extractor/ensureImportingConcat.native.js.map +0 -6
- package/dist/extractor/hoistClassNames.js +0 -63
- package/dist/extractor/hoistClassNames.js.map +0 -6
- package/dist/extractor/hoistClassNames.native.js +0 -66
- package/dist/extractor/hoistClassNames.native.js.map +0 -6
- package/src/extractor/buildClassName.ts +0 -76
- package/src/extractor/ensureImportingConcat.ts +0 -36
- package/src/extractor/hoistClassNames.ts +0 -52
- package/types/extractor/buildClassName.d.ts +0 -7
- package/types/extractor/buildClassName.d.ts.map +0 -1
- package/types/extractor/ensureImportingConcat.d.ts +0 -4
- package/types/extractor/ensureImportingConcat.d.ts.map +0 -1
- package/types/extractor/hoistClassNames.d.ts +0 -6
- package/types/extractor/hoistClassNames.d.ts.map +0 -1
|
@@ -163,10 +163,6 @@ export function getBabelParseDefinition(options: TamaguiOptions) {
|
|
|
163
163
|
]),
|
|
164
164
|
shouldPrintDebug,
|
|
165
165
|
...finalOptions,
|
|
166
|
-
// disable this extraction for now at least, need to figure out merging theme vs non-theme
|
|
167
|
-
// because theme need to stay in render(), whereas non-theme can be extracted
|
|
168
|
-
// for now just turn it off entirely at a small perf loss
|
|
169
|
-
disableExtractInlineMedia: true,
|
|
170
166
|
// disable extracting variables as no native concept of them (only theme values)
|
|
171
167
|
disableExtractVariables: options.experimentalFlattenThemesOnNative
|
|
172
168
|
? false
|
|
@@ -188,13 +184,6 @@ export function getBabelParseDefinition(options: TamaguiOptions) {
|
|
|
188
184
|
},
|
|
189
185
|
|
|
190
186
|
onExtractTag(props) {
|
|
191
|
-
const { isFlattened } = props
|
|
192
|
-
|
|
193
|
-
if (!isFlattened) {
|
|
194
|
-
// we aren't optimizing at all if not flattened anymore
|
|
195
|
-
return
|
|
196
|
-
}
|
|
197
|
-
|
|
198
187
|
assertValidTag(props.node)
|
|
199
188
|
const stylesExpr = t.arrayExpression([])
|
|
200
189
|
const hocStylesExpr = t.arrayExpression([])
|
|
@@ -285,37 +274,7 @@ export function getBabelParseDefinition(options: TamaguiOptions) {
|
|
|
285
274
|
consExpr || t.nullLiteral(),
|
|
286
275
|
altExpr || t.nullLiteral()
|
|
287
276
|
)
|
|
288
|
-
addStyleExpression(
|
|
289
|
-
styleExpr
|
|
290
|
-
// TODO: what is this for ?
|
|
291
|
-
// isFlattened ? simpleHash(JSON.stringify({ consequent, alternate })) : undefined
|
|
292
|
-
)
|
|
293
|
-
break
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
case 'dynamic-style': {
|
|
297
|
-
hasDynamicStyle = true
|
|
298
|
-
expressions.push(attr.value as t.Expression)
|
|
299
|
-
if (options.experimentalFlattenDynamicValues) {
|
|
300
|
-
addStyleExpression(
|
|
301
|
-
t.objectExpression([
|
|
302
|
-
t.objectProperty(
|
|
303
|
-
t.identifier(attr.name as string),
|
|
304
|
-
t.identifier(`_expressions[${expressions.length - 1}]`)
|
|
305
|
-
),
|
|
306
|
-
]),
|
|
307
|
-
true
|
|
308
|
-
)
|
|
309
|
-
} else {
|
|
310
|
-
addStyleExpression(
|
|
311
|
-
t.objectExpression([
|
|
312
|
-
t.objectProperty(
|
|
313
|
-
t.identifier(attr.name as string),
|
|
314
|
-
attr.value as t.Expression
|
|
315
|
-
),
|
|
316
|
-
])
|
|
317
|
-
)
|
|
318
|
-
}
|
|
277
|
+
addStyleExpression(styleExpr)
|
|
319
278
|
break
|
|
320
279
|
}
|
|
321
280
|
|
|
@@ -343,83 +302,81 @@ export function getBabelParseDefinition(options: TamaguiOptions) {
|
|
|
343
302
|
|
|
344
303
|
props.node.attributes = finalAttrs
|
|
345
304
|
|
|
346
|
-
if (
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
) {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
const name = props.node.name['name']
|
|
360
|
-
const WrapperIdentifier = root.scope.generateUidIdentifier(
|
|
361
|
-
name + 'Wrapper'
|
|
362
|
-
)
|
|
363
|
-
|
|
364
|
-
root.pushContainer(
|
|
365
|
-
'body',
|
|
366
|
-
t.variableDeclaration('const', [
|
|
367
|
-
t.variableDeclarator(
|
|
368
|
-
WrapperIdentifier,
|
|
369
|
-
t.callExpression(t.identifier('__withStableStyle'), [
|
|
370
|
-
t.identifier(name),
|
|
371
|
-
t.arrowFunctionExpression(
|
|
372
|
-
[t.identifier('theme'), t.identifier('_expressions')],
|
|
373
|
-
t.blockStatement([
|
|
374
|
-
t.returnStatement(
|
|
375
|
-
t.callExpression(t.identifier('__ReactUseMemo'), [
|
|
376
|
-
t.arrowFunctionExpression(
|
|
377
|
-
[],
|
|
378
|
-
t.blockStatement([
|
|
379
|
-
t.returnStatement(
|
|
380
|
-
t.arrayExpression([...hocStylesExpr.elements])
|
|
381
|
-
),
|
|
382
|
-
])
|
|
383
|
-
),
|
|
384
|
-
t.arrayExpression([
|
|
385
|
-
t.spreadElement(t.identifier('_expressions')),
|
|
386
|
-
]),
|
|
387
|
-
])
|
|
388
|
-
),
|
|
389
|
-
])
|
|
390
|
-
),
|
|
391
|
-
])
|
|
392
|
-
),
|
|
393
|
-
])
|
|
394
|
-
)
|
|
305
|
+
if (
|
|
306
|
+
options.experimentalFlattenThemesOnNative &&
|
|
307
|
+
(themeKeysUsed.size ||
|
|
308
|
+
hocStylesExpr.elements.length > 1 ||
|
|
309
|
+
hasDynamicStyle)
|
|
310
|
+
) {
|
|
311
|
+
if (!hasImportedViewWrapper) {
|
|
312
|
+
root.unshiftContainer('body', importWithStyle())
|
|
313
|
+
root.unshiftContainer('body', importReactUseMemo())
|
|
314
|
+
hasImportedViewWrapper = true
|
|
315
|
+
}
|
|
395
316
|
|
|
317
|
+
const name = props.node.name['name']
|
|
318
|
+
const WrapperIdentifier = root.scope.generateUidIdentifier(
|
|
319
|
+
name + 'Wrapper'
|
|
320
|
+
)
|
|
321
|
+
|
|
322
|
+
root.pushContainer(
|
|
323
|
+
'body',
|
|
324
|
+
t.variableDeclaration('const', [
|
|
325
|
+
t.variableDeclarator(
|
|
326
|
+
WrapperIdentifier,
|
|
327
|
+
t.callExpression(t.identifier('__withStableStyle'), [
|
|
328
|
+
t.identifier(name),
|
|
329
|
+
t.arrowFunctionExpression(
|
|
330
|
+
[t.identifier('theme'), t.identifier('_expressions')],
|
|
331
|
+
t.blockStatement([
|
|
332
|
+
t.returnStatement(
|
|
333
|
+
t.callExpression(t.identifier('__ReactUseMemo'), [
|
|
334
|
+
t.arrowFunctionExpression(
|
|
335
|
+
[],
|
|
336
|
+
t.blockStatement([
|
|
337
|
+
t.returnStatement(
|
|
338
|
+
t.arrayExpression([...hocStylesExpr.elements])
|
|
339
|
+
),
|
|
340
|
+
])
|
|
341
|
+
),
|
|
342
|
+
t.arrayExpression([
|
|
343
|
+
t.spreadElement(t.identifier('_expressions')),
|
|
344
|
+
]),
|
|
345
|
+
])
|
|
346
|
+
),
|
|
347
|
+
])
|
|
348
|
+
),
|
|
349
|
+
])
|
|
350
|
+
),
|
|
351
|
+
])
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
// @ts-ignore
|
|
355
|
+
props.node.name = WrapperIdentifier
|
|
356
|
+
if (props.jsxPath.node.closingElement) {
|
|
396
357
|
// @ts-ignore
|
|
397
|
-
props.node.name = WrapperIdentifier
|
|
398
|
-
|
|
399
|
-
// @ts-ignore
|
|
400
|
-
props.jsxPath.node.closingElement.name = WrapperIdentifier
|
|
401
|
-
}
|
|
358
|
+
props.jsxPath.node.closingElement.name = WrapperIdentifier
|
|
359
|
+
}
|
|
402
360
|
|
|
403
|
-
|
|
404
|
-
props.node.attributes.push(
|
|
405
|
-
t.jsxAttribute(
|
|
406
|
-
t.jsxIdentifier('expressions'),
|
|
407
|
-
t.jsxExpressionContainer(t.arrayExpression(expressions))
|
|
408
|
-
)
|
|
409
|
-
)
|
|
410
|
-
}
|
|
411
|
-
} else {
|
|
361
|
+
if (expressions.length) {
|
|
412
362
|
props.node.attributes.push(
|
|
413
363
|
t.jsxAttribute(
|
|
414
|
-
t.jsxIdentifier('
|
|
415
|
-
t.jsxExpressionContainer(
|
|
416
|
-
stylesExpr.elements.length === 1
|
|
417
|
-
? (stylesExpr.elements[0] as any)
|
|
418
|
-
: stylesExpr
|
|
419
|
-
)
|
|
364
|
+
t.jsxIdentifier('expressions'),
|
|
365
|
+
t.jsxExpressionContainer(t.arrayExpression(expressions))
|
|
420
366
|
)
|
|
421
367
|
)
|
|
422
368
|
}
|
|
369
|
+
} else {
|
|
370
|
+
props.node.attributes.push(
|
|
371
|
+
t.jsxAttribute(
|
|
372
|
+
t.jsxIdentifier('style'),
|
|
373
|
+
t.jsxExpressionContainer(
|
|
374
|
+
stylesExpr.elements.length === 1
|
|
375
|
+
? (stylesExpr.elements[0] as any)
|
|
376
|
+
: stylesExpr
|
|
377
|
+
)
|
|
378
|
+
)
|
|
379
|
+
)
|
|
423
380
|
}
|
|
424
381
|
},
|
|
425
382
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import generate from '@babel/generator'
|
|
2
2
|
import * as t from '@babel/types'
|
|
3
|
+
import { mergeProps } from '@tamagui/web'
|
|
3
4
|
import invariant from 'invariant'
|
|
4
|
-
|
|
5
5
|
import type { Ternary } from '../types'
|
|
6
6
|
|
|
7
7
|
export function normalizeTernaries(ternaries: Ternary[]) {
|
|
@@ -56,8 +56,12 @@ export function normalizeTernaries(ternaries: Ternary[]) {
|
|
|
56
56
|
}
|
|
57
57
|
const altStyle = (shouldSwap ? consequent : alternate) ?? {}
|
|
58
58
|
const consStyle = (shouldSwap ? alternate : consequent) ?? {}
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
|
|
60
|
+
ternariesByKey[key].alternate = mergeProps(altStyle, ternariesByKey[key].alternate!)
|
|
61
|
+
ternariesByKey[key].consequent = mergeProps(
|
|
62
|
+
consStyle,
|
|
63
|
+
ternariesByKey[key].consequent!
|
|
64
|
+
)
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
const ternaryExpression = Object.keys(ternariesByKey).map((key) => {
|
package/src/registerRequire.ts
CHANGED
|
@@ -54,7 +54,7 @@ export function registerRequire(
|
|
|
54
54
|
return og.apply(this, ['tamagui/native'])
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
if (path === '@tamagui/core'
|
|
57
|
+
if (path === '@tamagui/core') {
|
|
58
58
|
return requireTamaguiCore(platform, (path) => {
|
|
59
59
|
return og.apply(this, [path])
|
|
60
60
|
})
|
package/src/types.ts
CHANGED
|
@@ -39,6 +39,7 @@ export type ExtractorOptions = {
|
|
|
39
39
|
export type ExtractedAttrAttr = {
|
|
40
40
|
type: 'attr'
|
|
41
41
|
value: t.JSXAttribute | t.JSXSpreadAttribute
|
|
42
|
+
extraClassNames?: string
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
export type ExtractedAttrStyle = {
|
|
@@ -46,19 +47,15 @@ export type ExtractedAttrStyle = {
|
|
|
46
47
|
value: ViewStyle & PseudoStyles
|
|
47
48
|
attr?: t.JSXAttribute | t.JSXSpreadAttribute
|
|
48
49
|
name?: string
|
|
50
|
+
extraClassNames?: string
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
export type
|
|
52
|
-
type: '
|
|
53
|
-
|
|
54
|
-
value: t.Expression | t.JSXEmptyExpression
|
|
53
|
+
export type ExtractedTernaryAttr = {
|
|
54
|
+
type: 'ternary'
|
|
55
|
+
value: Ternary
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
export type ExtractedAttr =
|
|
58
|
-
| ExtractedAttrAttr
|
|
59
|
-
| { type: 'ternary'; value: Ternary }
|
|
60
|
-
| ExtractedAttrStyle
|
|
61
|
-
| ExtractedDynAttrStyle
|
|
58
|
+
export type ExtractedAttr = ExtractedAttrAttr | ExtractedTernaryAttr | ExtractedAttrStyle
|
|
62
59
|
|
|
63
60
|
export type ExtractTagProps = {
|
|
64
61
|
parserProps: TamaguiOptionsWithFileInfo
|
|
@@ -70,7 +67,6 @@ export type ExtractTagProps = {
|
|
|
70
67
|
originalNodeName: string
|
|
71
68
|
lineNumbers: string
|
|
72
69
|
filePath: string
|
|
73
|
-
isFlattened: boolean
|
|
74
70
|
completeProps: Record<string, any>
|
|
75
71
|
staticConfig: StaticConfig
|
|
76
72
|
config: TamaguiConfig
|
|
@@ -91,16 +87,16 @@ export type ExtractorParseProps = Omit<
|
|
|
91
87
|
getFlattenedNode?: (props: { isTextView: boolean; tag: string }) => string
|
|
92
88
|
extractStyledDefinitions?: boolean
|
|
93
89
|
// identifer, rule
|
|
94
|
-
|
|
90
|
+
onStyledDefinitionRule?: (identifier: string, rules: string[]) => void
|
|
95
91
|
}
|
|
96
92
|
|
|
97
93
|
export interface Ternary {
|
|
98
94
|
test: t.Expression
|
|
99
|
-
// shorthand props that don't use hooks
|
|
100
|
-
inlineMediaQuery?: string
|
|
101
95
|
remove: Function
|
|
102
96
|
consequent: Object | null
|
|
103
97
|
alternate: Object | null
|
|
98
|
+
fontFamily?: string
|
|
99
|
+
inlineMediaQuery?: string
|
|
104
100
|
}
|
|
105
101
|
|
|
106
102
|
export type ClassNameToStyleObj = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createExtractor.d.ts","sourceRoot":"","sources":["../../src/extractor/createExtractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,iBAAiB,CAAA;AAEhE,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAiBjC,OAAO,KAAK,EAGV,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EAGf,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAcxD,OAAO,EAAE,iBAAiB,EAA6B,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"createExtractor.d.ts","sourceRoot":"","sources":["../../src/extractor/createExtractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,iBAAiB,CAAA;AAEhE,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAiBjC,OAAO,KAAK,EAGV,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EAGf,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAcxD,OAAO,EAAE,iBAAiB,EAA6B,MAAM,6BAA6B,CAAA;AAiB1F,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAE1D,KAAK,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAQ9C,wBAAgB,eAAe,CAC7B,EAAE,MAAgB,EAAE,QAAgB,EAAE,GAAE,gBAAsC;;;;;yBAuDnD,cAAc;6BAPhB,cAAc;;mBAwBtB,UAAU,SAAS,mBAAmB;;;;;;;eAKpC,UAAU,SAAS,mBAAmB;;;;;;;EA+oE1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractToClassNames.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToClassNames.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extractToClassNames.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToClassNames.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAKjC,OAAO,KAAK,EAAe,cAAc,EAAW,MAAM,UAAU,CAAA;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAOlD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,CAAC,CAAC,IAAI,CAAA;IACX,GAAG,EAAE,GAAG,CAAA;CACT,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,cAAc,CAAA;IACvB,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;CACtC,CAAA;AAQD,wBAAsB,mBAAmB,CAAC,EACxC,SAAS,EACT,MAAM,EACN,UAAe,EACf,OAAO,EACP,gBAAgB,GACjB,EAAE,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAsc9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractToNative.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToNative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,aAAa,CAAA;AAQxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AA4B9C,wBAAgB,eAAe,CAC7B,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,GACtB,eAAe,CAoBjB;AAED,wBAAgB,cAAc,QAK7B;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc;;;;wBAM3C,GAAG;;;
|
|
1
|
+
{"version":3,"file":"extractToNative.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToNative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,aAAa,CAAA;AAQxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AA4B9C,wBAAgB,eAAe,CAC7B,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,GACtB,eAAe,CAoBjB;AAED,wBAAgB,cAAc,QAK7B;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc;;;;wBAM3C,GAAG;;;EAmWtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeTernaries.d.ts","sourceRoot":"","sources":["../../src/extractor/normalizeTernaries.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEvC,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"normalizeTernaries.d.ts","sourceRoot":"","sources":["../../src/extractor/normalizeTernaries.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEvC,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,aAiEtD"}
|
package/types/types.d.ts
CHANGED
|
@@ -29,22 +29,20 @@ export type ExtractorOptions = {
|
|
|
29
29
|
export type ExtractedAttrAttr = {
|
|
30
30
|
type: 'attr';
|
|
31
31
|
value: t.JSXAttribute | t.JSXSpreadAttribute;
|
|
32
|
+
extraClassNames?: string;
|
|
32
33
|
};
|
|
33
34
|
export type ExtractedAttrStyle = {
|
|
34
35
|
type: 'style';
|
|
35
36
|
value: ViewStyle & PseudoStyles;
|
|
36
37
|
attr?: t.JSXAttribute | t.JSXSpreadAttribute;
|
|
37
38
|
name?: string;
|
|
39
|
+
extraClassNames?: string;
|
|
38
40
|
};
|
|
39
|
-
export type
|
|
40
|
-
type: 'dynamic-style';
|
|
41
|
-
name?: string;
|
|
42
|
-
value: t.Expression | t.JSXEmptyExpression;
|
|
43
|
-
};
|
|
44
|
-
export type ExtractedAttr = ExtractedAttrAttr | {
|
|
41
|
+
export type ExtractedTernaryAttr = {
|
|
45
42
|
type: 'ternary';
|
|
46
43
|
value: Ternary;
|
|
47
|
-
}
|
|
44
|
+
};
|
|
45
|
+
export type ExtractedAttr = ExtractedAttrAttr | ExtractedTernaryAttr | ExtractedAttrStyle;
|
|
48
46
|
export type ExtractTagProps = {
|
|
49
47
|
parserProps: TamaguiOptionsWithFileInfo;
|
|
50
48
|
attrs: ExtractedAttr[];
|
|
@@ -55,7 +53,6 @@ export type ExtractTagProps = {
|
|
|
55
53
|
originalNodeName: string;
|
|
56
54
|
lineNumbers: string;
|
|
57
55
|
filePath: string;
|
|
58
|
-
isFlattened: boolean;
|
|
59
56
|
completeProps: Record<string, any>;
|
|
60
57
|
staticConfig: StaticConfig;
|
|
61
58
|
config: TamaguiConfig;
|
|
@@ -73,14 +70,15 @@ export type ExtractorParseProps = Omit<TamaguiOptionsWithFileInfo, 'allLoadedCom
|
|
|
73
70
|
tag: string;
|
|
74
71
|
}) => string;
|
|
75
72
|
extractStyledDefinitions?: boolean;
|
|
76
|
-
|
|
73
|
+
onStyledDefinitionRule?: (identifier: string, rules: string[]) => void;
|
|
77
74
|
};
|
|
78
75
|
export interface Ternary {
|
|
79
76
|
test: t.Expression;
|
|
80
|
-
inlineMediaQuery?: string;
|
|
81
77
|
remove: Function;
|
|
82
78
|
consequent: Object | null;
|
|
83
79
|
alternate: Object | null;
|
|
80
|
+
fontFamily?: string;
|
|
81
|
+
inlineMediaQuery?: string;
|
|
84
82
|
}
|
|
85
83
|
export type ClassNameToStyleObj = {
|
|
86
84
|
[key: string]: StyleObject;
|
package/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,KAAK,CAAC,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,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AA;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,KAAK,GAAG,CAAA;CAC/D"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
-
mod
|
|
22
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
-
var buildClassName_exports = {};
|
|
24
|
-
__export(buildClassName_exports, {
|
|
25
|
-
buildClassName: () => buildClassName,
|
|
26
|
-
buildClassNameLogic: () => buildClassNameLogic
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(buildClassName_exports);
|
|
29
|
-
var t = __toESM(require("@babel/types"));
|
|
30
|
-
const buildClassName = (objectsIn, extras = "") => {
|
|
31
|
-
let objects = buildClassNameLogic(objectsIn);
|
|
32
|
-
return objects ? (t.isStringLiteral(objects) ? objects.value = `${extras} ${objects.value}` : objects = t.binaryExpression("+", t.stringLiteral(extras), objects), objects) : null;
|
|
33
|
-
}, buildClassNameLogic = (objects) => objects.reduce((acc, val) => {
|
|
34
|
-
if (acc == null)
|
|
35
|
-
return (
|
|
36
|
-
// pass conditional expressions through
|
|
37
|
-
t.isConditionalExpression(val) || // pass non-null literals through
|
|
38
|
-
t.isStringLiteral(val) || t.isNumericLiteral(val) ? val : t.logicalExpression("||", val, t.stringLiteral(""))
|
|
39
|
-
);
|
|
40
|
-
let inner;
|
|
41
|
-
if (t.isStringLiteral(val)) {
|
|
42
|
-
if (t.isStringLiteral(acc))
|
|
43
|
-
return t.stringLiteral(`${acc.value} ${val.value}`);
|
|
44
|
-
inner = t.stringLiteral(` ${val.value}`);
|
|
45
|
-
} else if (t.isLiteral(val))
|
|
46
|
-
inner = t.binaryExpression("+", t.stringLiteral(" "), val);
|
|
47
|
-
else if (t.isConditionalExpression(val) || t.isBinaryExpression(val)) {
|
|
48
|
-
if (t.isStringLiteral(acc))
|
|
49
|
-
return t.binaryExpression("+", t.stringLiteral(`${acc.value} `), val);
|
|
50
|
-
inner = t.binaryExpression("+", t.stringLiteral(" "), val);
|
|
51
|
-
} else if (t.isIdentifier(val) || t.isMemberExpression(val))
|
|
52
|
-
inner = t.conditionalExpression(
|
|
53
|
-
val,
|
|
54
|
-
t.binaryExpression("+", t.stringLiteral(" "), val),
|
|
55
|
-
t.stringLiteral("")
|
|
56
|
-
);
|
|
57
|
-
else {
|
|
58
|
-
if (t.isStringLiteral(acc))
|
|
59
|
-
return t.binaryExpression(
|
|
60
|
-
"+",
|
|
61
|
-
t.stringLiteral(`${acc.value} `),
|
|
62
|
-
t.logicalExpression("||", val, t.stringLiteral(""))
|
|
63
|
-
);
|
|
64
|
-
inner = t.binaryExpression(
|
|
65
|
-
"+",
|
|
66
|
-
t.stringLiteral(" "),
|
|
67
|
-
t.logicalExpression("||", val, t.stringLiteral(""))
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
return t.binaryExpression("+", acc, inner);
|
|
71
|
-
}, null);
|
|
72
|
-
//# sourceMappingURL=buildClassName.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/extractor/buildClassName.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAmB;AASZ,MAAM,iBAA0B,CAAC,WAAW,SAAS,OAAO;AACjE,MAAI,UAAU,oBAAoB,SAAS;AAC3C,SAAK,WACD,EAAE,gBAAgB,OAAO,IAE3B,QAAQ,QAAQ,GAAG,MAAM,IAAI,QAAQ,KAAK,KAE1C,UAAU,EAAE,iBAAiB,KAAK,EAAE,cAAc,MAAM,GAAG,OAAO,GAE7D,WAPc;AAQvB,GAEa,sBAA+B,CAAC,YACpC,QAAQ,OAA4B,CAAC,KAAK,QAAQ;AACvD,MAAI,OAAO;AACT;AAAA;AAAA,MAEE,EAAE,wBAAwB,GAAG;AAAA,MAE7B,EAAE,gBAAgB,GAAG,KACrB,EAAE,iBAAiB,GAAG,IAEf,MAEF,EAAE,kBAAkB,MAAM,KAAK,EAAE,cAAc,EAAE,CAAC;AAAA;AAG3D,MAAI;AACJ,MAAI,EAAE,gBAAgB,GAAG,GAAG;AAC1B,QAAI,EAAE,gBAAgB,GAAG;AAEvB,aAAO,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,IAAI,KAAK,EAAE;AAEpD,YAAQ,EAAE,cAAc,IAAI,IAAI,KAAK,EAAE;AAAA,EACzC,WAAW,EAAE,UAAU,GAAG;AACxB,YAAQ,EAAE,iBAAiB,KAAK,EAAE,cAAc,GAAG,GAAG,GAAG;AAAA,WAChD,EAAE,wBAAwB,GAAG,KAAK,EAAE,mBAAmB,GAAG,GAAG;AACtE,QAAI,EAAE,gBAAgB,GAAG;AACvB,aAAO,EAAE,iBAAiB,KAAK,EAAE,cAAc,GAAG,IAAI,KAAK,GAAG,GAAG,GAAG;AAEtE,YAAQ,EAAE,iBAAiB,KAAK,EAAE,cAAc,GAAG,GAAG,GAAG;AAAA,EAC3D,WAAW,EAAE,aAAa,GAAG,KAAK,EAAE,mBAAmB,GAAG;AAExD,YAAQ,EAAE;AAAA,MACR;AAAA,MACA,EAAE,iBAAiB,KAAK,EAAE,cAAc,GAAG,GAAG,GAAG;AAAA,MACjD,EAAE,cAAc,EAAE;AAAA,IACpB;AAAA,OACK;AACL,QAAI,EAAE,gBAAgB,GAAG;AACvB,aAAO,EAAE;AAAA,QACP;AAAA,QACA,EAAE,cAAc,GAAG,IAAI,KAAK,GAAG;AAAA,QAC/B,EAAE,kBAAkB,MAAM,KAAK,EAAE,cAAc,EAAE,CAAC;AAAA,MACpD;AAGF,YAAQ,EAAE;AAAA,MACR;AAAA,MACA,EAAE,cAAc,GAAG;AAAA,MACnB,EAAE,kBAAkB,MAAM,KAAK,EAAE,cAAc,EAAE,CAAC;AAAA,IACpD;AAAA,EACF;AAEA,SAAO,EAAE,iBAAiB,KAAK,KAAK,KAAK;AAC3C,GAAG,IAAI;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
10
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
-
mod
|
|
23
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
24
|
-
var buildClassName_exports = {};
|
|
25
|
-
__export(buildClassName_exports, {
|
|
26
|
-
buildClassName: () => buildClassName,
|
|
27
|
-
buildClassNameLogic: () => buildClassNameLogic
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(buildClassName_exports);
|
|
30
|
-
var t = __toESM(require("@babel/types")), buildClassName = function(objectsIn) {
|
|
31
|
-
var extras = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", objects = buildClassNameLogic(objectsIn);
|
|
32
|
-
return objects ? (t.isStringLiteral(objects) ? objects.value = `${extras} ${objects.value}` : objects = t.binaryExpression("+", t.stringLiteral(extras), objects), objects) : null;
|
|
33
|
-
}, buildClassNameLogic = function(objects) {
|
|
34
|
-
return objects.reduce(function(acc, val) {
|
|
35
|
-
if (acc == null)
|
|
36
|
-
return (
|
|
37
|
-
// pass conditional expressions through
|
|
38
|
-
t.isConditionalExpression(val) || // pass non-null literals through
|
|
39
|
-
t.isStringLiteral(val) || t.isNumericLiteral(val) ? val : t.logicalExpression("||", val, t.stringLiteral(""))
|
|
40
|
-
);
|
|
41
|
-
var inner;
|
|
42
|
-
if (t.isStringLiteral(val)) {
|
|
43
|
-
if (t.isStringLiteral(acc))
|
|
44
|
-
return t.stringLiteral(`${acc.value} ${val.value}`);
|
|
45
|
-
inner = t.stringLiteral(` ${val.value}`);
|
|
46
|
-
} else if (t.isLiteral(val))
|
|
47
|
-
inner = t.binaryExpression("+", t.stringLiteral(" "), val);
|
|
48
|
-
else if (t.isConditionalExpression(val) || t.isBinaryExpression(val)) {
|
|
49
|
-
if (t.isStringLiteral(acc))
|
|
50
|
-
return t.binaryExpression("+", t.stringLiteral(`${acc.value} `), val);
|
|
51
|
-
inner = t.binaryExpression("+", t.stringLiteral(" "), val);
|
|
52
|
-
} else if (t.isIdentifier(val) || t.isMemberExpression(val))
|
|
53
|
-
inner = t.conditionalExpression(val, t.binaryExpression("+", t.stringLiteral(" "), val), t.stringLiteral(""));
|
|
54
|
-
else {
|
|
55
|
-
if (t.isStringLiteral(acc))
|
|
56
|
-
return t.binaryExpression("+", t.stringLiteral(`${acc.value} `), t.logicalExpression("||", val, t.stringLiteral("")));
|
|
57
|
-
inner = t.binaryExpression("+", t.stringLiteral(" "), t.logicalExpression("||", val, t.stringLiteral("")));
|
|
58
|
-
}
|
|
59
|
-
return t.binaryExpression("+", acc, inner);
|
|
60
|
-
}, null);
|
|
61
|
-
};
|
|
62
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
-
0 && (module.exports = {
|
|
64
|
-
buildClassName,
|
|
65
|
-
buildClassNameLogic
|
|
66
|
-
});
|
|
67
|
-
//# sourceMappingURL=buildClassName.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,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GAAG,GAAGK,GAAAA;AAEnEI,cAAQX,EAAEG,iBAAiB,KAAKH,EAAEI,cAAc,GAAA,GAAMG,GAAAA;IACxD,WAAWP,EAAEc,aAAaP,GAAAA,KAAQP,EAAEe,mBAAmBR,GAAAA;AAErDI,cAAQX,EAAEgB,sBACRT,KACAP,EAAEG,iBAAiB,KAAKH,EAAEI,cAAc,GAAA,GAAMG,GAAAA,GAC9CP,EAAEI,cAAc,EAAA,CAAA;SAEb;AACL,UAAIJ,EAAEC,gBAAgBK,GAAAA;AACpB,eAAON,EAAEG,iBACP,KACAH,EAAEI,cAAc,GAAGE,IAAIJ,KAAK,GAAG,GAC/BF,EAAEU,kBAAkB,MAAMH,KAAKP,EAAEI,cAAc,EAAA,CAAA,CAAA;AAInDO,cAAQX,EAAEG,iBACR,KACAH,EAAEI,cAAc,GAAA,GAChBJ,EAAEU,kBAAkB,MAAMH,KAAKP,EAAEI,cAAc,EAAA,CAAA,CAAA;IAEnD;AAEA,WAAOJ,EAAEG,iBAAiB,KAAKG,KAAKK,KAAAA;EACtC,GAAG,IAAA;AACL;",
|
|
5
|
-
"names": ["buildClassName", "objectsIn", "extras", "objects", "buildClassNameLogic", "t", "isStringLiteral", "value", "binaryExpression", "stringLiteral", "reduce", "acc", "val", "isConditionalExpression", "isNumericLiteral", "logicalExpression", "inner", "isLiteral", "isBinaryExpression", "isIdentifier", "isMemberExpression", "conditionalExpression"]
|
|
6
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
-
mod
|
|
22
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
-
var ensureImportingConcat_exports = {};
|
|
24
|
-
__export(ensureImportingConcat_exports, {
|
|
25
|
-
ensureImportingConcat: () => ensureImportingConcat
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(ensureImportingConcat_exports);
|
|
28
|
-
var t = __toESM(require("@babel/types"));
|
|
29
|
-
const importConcatPkg = "@tamagui/helpers";
|
|
30
|
-
function ensureImportingConcat(path) {
|
|
31
|
-
const imported = path.get("body").find(
|
|
32
|
-
(x) => x.isImportDeclaration() && x.node.source.value === importConcatPkg
|
|
33
|
-
), importSpecifier = t.importSpecifier(
|
|
34
|
-
t.identifier("concatClassName"),
|
|
35
|
-
t.identifier("concatClassName")
|
|
36
|
-
);
|
|
37
|
-
if (!imported) {
|
|
38
|
-
path.node.body.push(
|
|
39
|
-
t.importDeclaration([importSpecifier], t.stringLiteral(importConcatPkg))
|
|
40
|
-
);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const specifiers = imported.node.specifiers;
|
|
44
|
-
specifiers.some(
|
|
45
|
-
(x) => t.isImportSpecifier(x) && t.isIdentifier(x.imported) && x.imported.name === "concatClassName"
|
|
46
|
-
) || specifiers.push(
|
|
47
|
-
t.importSpecifier(t.identifier("concatClassName"), t.identifier("concatClassName"))
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=ensureImportingConcat.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/extractor/ensureImportingConcat.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,QAAmB;AAEnB,MAAM,kBAAkB;AAEjB,SAAS,sBAAsB,MAA2B;AAE/D,QAAM,WADW,KAAK,IAAI,MAAM,EACqC;AAAA,IACnE,CAAC,MAAM,EAAE,oBAAoB,KAAK,EAAE,KAAK,OAAO,UAAU;AAAA,EAC5D,GACM,kBAAkB,EAAE;AAAA,IACxB,EAAE,WAAW,iBAAiB;AAAA,IAC9B,EAAE,WAAW,iBAAiB;AAAA,EAChC;AAEA,MAAI,CAAC,UAAU;AACb,SAAK,KAAK,KAAK;AAAA,MACb,EAAE,kBAAkB,CAAC,eAAe,GAAG,EAAE,cAAc,eAAe,CAAC;AAAA,IACzE;AACA;AAAA,EACF;AAEA,QAAM,aAAa,SAAS,KAAK;AAQjC,EAPwB,WAAW;AAAA,IACjC,CAAC,MACC,EAAE,kBAAkB,CAAC,KACrB,EAAE,aAAa,EAAE,QAAQ,KACzB,EAAE,SAAS,SAAS;AAAA,EACxB,KAGE,WAAW;AAAA,IACT,EAAE,gBAAgB,EAAE,WAAW,iBAAiB,GAAG,EAAE,WAAW,iBAAiB,CAAC;AAAA,EACpF;AAEJ;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|