@tamagui/static 1.132.16 → 1.132.17
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/createEvaluator.js +13 -1
- package/dist/extractor/createEvaluator.js.map +1 -1
- package/dist/extractor/createEvaluator.native.js +6 -1
- package/dist/extractor/createEvaluator.native.js.map +2 -2
- package/dist/extractor/createExtractor.js +60 -114
- package/dist/extractor/createExtractor.js.map +1 -1
- package/dist/extractor/createExtractor.native.js +70 -123
- package/dist/extractor/createExtractor.native.js.map +2 -2
- package/dist/extractor/errors.js +22 -0
- package/dist/extractor/errors.js.map +6 -0
- package/dist/extractor/errors.native.js +119 -0
- package/dist/extractor/errors.native.js.map +6 -0
- 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 +206 -172
- package/dist/extractor/extractToClassNames.js.map +2 -2
- package/dist/extractor/extractToClassNames.native.js +212 -188
- 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 -3
- package/dist/extractor/normalizeTernaries.js.map +1 -1
- package/dist/extractor/normalizeTernaries.native.js +5 -3
- package/dist/extractor/normalizeTernaries.native.js.map +2 -2
- package/dist/extractor/propsToFontFamilyCache.js +7 -8
- package/dist/extractor/propsToFontFamilyCache.js.map +1 -1
- package/dist/extractor/propsToFontFamilyCache.native.js +9 -10
- package/dist/extractor/propsToFontFamilyCache.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/createEvaluator.ts +26 -1
- package/src/extractor/createExtractor.ts +108 -194
- package/src/extractor/errors.ts +1 -0
- package/src/extractor/extractMediaStyle.ts +1 -1
- package/src/extractor/extractToClassNames.ts +362 -266
- package/src/extractor/extractToNative.ts +68 -111
- package/src/extractor/normalizeTernaries.ts +10 -3
- package/src/extractor/propsToFontFamilyCache.ts +5 -5
- package/src/registerRequire.ts +1 -1
- package/src/types.ts +10 -13
- package/types/extractor/createEvaluator.d.ts.map +1 -1
- package/types/extractor/createExtractor.d.ts.map +1 -1
- package/types/extractor/errors.d.ts +3 -0
- package/types/extractor/errors.d.ts.map +1 -0
- 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/extractor/propsToFontFamilyCache.d.ts +2 -2
- package/types/extractor/propsToFontFamilyCache.d.ts.map +1 -1
- package/types/types.d.ts +9 -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.flatNodeName || 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,8 +1,9 @@
|
|
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
|
+
import { forwardFontFamilyName } from './propsToFontFamilyCache'
|
6
7
|
|
7
8
|
export function normalizeTernaries(ternaries: Ternary[]) {
|
8
9
|
invariant(
|
@@ -56,8 +57,14 @@ export function normalizeTernaries(ternaries: Ternary[]) {
|
|
56
57
|
}
|
57
58
|
const altStyle = (shouldSwap ? consequent : alternate) ?? {}
|
58
59
|
const consStyle = (shouldSwap ? alternate : consequent) ?? {}
|
59
|
-
|
60
|
-
|
60
|
+
|
61
|
+
const nextAlt = ternariesByKey[key].alternate!
|
62
|
+
ternariesByKey[key].alternate = mergeProps(altStyle, nextAlt)
|
63
|
+
forwardFontFamilyName(altStyle, ternariesByKey[key].alternate)
|
64
|
+
|
65
|
+
const nextCons = ternariesByKey[key].consequent!
|
66
|
+
ternariesByKey[key].consequent = mergeProps(consStyle, nextCons)
|
67
|
+
forwardFontFamilyName(consStyle, ternariesByKey[key].consequent)
|
61
68
|
}
|
62
69
|
|
63
70
|
const ternaryExpression = Object.keys(ternariesByKey).map((key) => {
|
@@ -3,16 +3,16 @@
|
|
3
3
|
const cache = new WeakMap<any, string>()
|
4
4
|
|
5
5
|
export function setPropsToFontFamily(props: any, ff: string) {
|
6
|
-
cache.set(props, ff)
|
6
|
+
cache.set(props, ff.replace('$', '').trim())
|
7
7
|
}
|
8
8
|
|
9
|
-
export function
|
9
|
+
export function getFontFamilyNameFromProps(props: any) {
|
10
10
|
return cache.get(props)
|
11
11
|
}
|
12
12
|
|
13
|
-
export function
|
14
|
-
const ff =
|
13
|
+
export function forwardFontFamilyName(prev: any, next: any, fallback?: string) {
|
14
|
+
const ff = getFontFamilyNameFromProps(prev) || fallback
|
15
15
|
if (ff) {
|
16
|
-
|
16
|
+
setPropsToFontFamily(next, ff)
|
17
17
|
}
|
18
18
|
}
|
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,31 +47,27 @@ 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
|
65
62
|
attrs: ExtractedAttr[]
|
66
63
|
node: t.JSXOpeningElement
|
67
64
|
attemptEval: (exprNode: t.Node, evalFn?: ((node: t.Node) => any) | undefined) => any
|
65
|
+
flatNodeName?: string
|
68
66
|
jsxPath: NodePath<t.JSXElement>
|
69
67
|
programPath: NodePath<t.Program>
|
70
68
|
originalNodeName: string
|
71
69
|
lineNumbers: string
|
72
70
|
filePath: string
|
73
|
-
isFlattened: boolean
|
74
71
|
completeProps: Record<string, any>
|
75
72
|
staticConfig: StaticConfig
|
76
73
|
config: TamaguiConfig
|
@@ -91,16 +88,16 @@ export type ExtractorParseProps = Omit<
|
|
91
88
|
getFlattenedNode?: (props: { isTextView: boolean; tag: string }) => string
|
92
89
|
extractStyledDefinitions?: boolean
|
93
90
|
// identifer, rule
|
94
|
-
|
91
|
+
onStyledDefinitionRule?: (identifier: string, rules: string[]) => void
|
95
92
|
}
|
96
93
|
|
97
94
|
export interface Ternary {
|
98
95
|
test: t.Expression
|
99
|
-
// shorthand props that don't use hooks
|
100
|
-
inlineMediaQuery?: string
|
101
96
|
remove: Function
|
102
97
|
consequent: Object | null
|
103
98
|
alternate: Object | null
|
99
|
+
fontFamily?: string
|
100
|
+
inlineMediaQuery?: string
|
104
101
|
}
|
105
102
|
|
106
103
|
export type ClassNameToStyleObj = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createEvaluator.d.ts","sourceRoot":"","sources":["../../src/extractor/createEvaluator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAIjC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAA;AAG1D,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,eAAe,EACf,UAAU,EACV,YAAY,EACZ,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,0BAA0B,CAAA;IACjC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;IACrC,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;CACtC,
|
1
|
+
{"version":3,"file":"createEvaluator.d.ts","sourceRoot":"","sources":["../../src/extractor/createEvaluator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAIjC,OAAO,KAAK,EAA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BtB,UAAU,SAAS,mBAAmB;;;;;;;eAKpC,UAAU,SAAS,mBAAmB;;;;;;;
|
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;AAkB1F,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;;;;;;;EA0pE1D"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/extractor/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,qBAAsB,SAAQ,KAAK;CAAG"}
|
@@ -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;AAWlD,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,CA8c9D"}
|
@@ -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;
|
1
|
+
{"version":3,"file":"normalizeTernaries.d.ts","sourceRoot":"","sources":["../../src/extractor/normalizeTernaries.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAGvC,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,aAmEtD"}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
export declare function setPropsToFontFamily(props: any, ff: string): void;
|
2
|
-
export declare function
|
3
|
-
export declare function
|
2
|
+
export declare function getFontFamilyNameFromProps(props: any): string | undefined;
|
3
|
+
export declare function forwardFontFamilyName(prev: any, next: any, fallback?: string): void;
|
4
4
|
//# sourceMappingURL=propsToFontFamilyCache.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"propsToFontFamilyCache.d.ts","sourceRoot":"","sources":["../../src/extractor/propsToFontFamilyCache.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,QAE1D;AAED,wBAAgB,
|
1
|
+
{"version":3,"file":"propsToFontFamilyCache.d.ts","sourceRoot":"","sources":["../../src/extractor/propsToFontFamilyCache.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,QAE1D;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,GAAG,sBAEpD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,MAAM,QAK5E"}
|
package/types/types.d.ts
CHANGED
@@ -29,33 +29,31 @@ 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[];
|
51
49
|
node: t.JSXOpeningElement;
|
52
50
|
attemptEval: (exprNode: t.Node, evalFn?: ((node: t.Node) => any) | undefined) => any;
|
51
|
+
flatNodeName?: string;
|
53
52
|
jsxPath: NodePath<t.JSXElement>;
|
54
53
|
programPath: NodePath<t.Program>;
|
55
54
|
originalNodeName: string;
|
56
55
|
lineNumbers: string;
|
57
56
|
filePath: string;
|
58
|
-
isFlattened: boolean;
|
59
57
|
completeProps: Record<string, any>;
|
60
58
|
staticConfig: StaticConfig;
|
61
59
|
config: TamaguiConfig;
|
@@ -73,14 +71,15 @@ export type ExtractorParseProps = Omit<TamaguiOptionsWithFileInfo, 'allLoadedCom
|
|
73
71
|
tag: string;
|
74
72
|
}) => string;
|
75
73
|
extractStyledDefinitions?: boolean;
|
76
|
-
|
74
|
+
onStyledDefinitionRule?: (identifier: string, rules: string[]) => void;
|
77
75
|
};
|
78
76
|
export interface Ternary {
|
79
77
|
test: t.Expression;
|
80
|
-
inlineMediaQuery?: string;
|
81
78
|
remove: Function;
|
82
79
|
consequent: Object | null;
|
83
80
|
alternate: Object | null;
|
81
|
+
fontFamily?: string;
|
82
|
+
inlineMediaQuery?: string;
|
84
83
|
}
|
85
84
|
export type ClassNameToStyleObj = {
|
86
85
|
[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,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAEhE,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,KAAK,CAAA;AAE9C,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzE,YAAY,EAAE,WAAW,EA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AM,MAAM,mBAAmB,GAAG,IAAI,CACpC,0BAA0B,EAC1B,qBAAqB,CACtB,GAAG;IACF,QAAQ,EAAE,eAAe,CAAA;IACzB,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACtC,YAAY,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IAC9C,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,UAAU,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAA;IAC1E,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAElC,sBAAsB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CACvE,CAAA;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,CAAC,CAAC,UAAU,CAAA;IAClB,MAAM,EAAE,QAAQ,CAAA;IAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAA;CAC3B,CAAA;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;AAC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gB,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,
|
3
|
-
"sources": ["../../src/extractor/buildClassName.ts"],
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;QAAmB,kCASNA,iBAA0B,SAACC,WAAAA;MAAWC,SAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAS,IACtDC,UAAUC,oBAAoBH,SAAAA;AAClC,SAAKE,WACDE,EAAEC,gBAAgBH,OAAAA,IAEpBA,QAAQI,QAAQ,GAAGL,MAAAA,IAAUC,QAAQI,KAAK,KAE1CJ,UAAUE,EAAEG,iBAAiB,KAAKH,EAAEI,cAAcP,MAAAA,GAASC,OAAAA,GAEtDA,WAPc;AAQvB,GAEaC,sBAA+B,SAACD,SAAAA;AAC3C,SAAOA,QAAQO,OAA4B,SAACC,KAAKC,KAAAA;AAC/C,QAAID,OAAO;AACT;;QAEEN,EAAEQ,wBAAwBD,GAAAA;QAE1BP,EAAEC,gBAAgBM,GAAAA,KAClBP,EAAES,iBAAiBF,GAAAA,IAEZA,MAEFP,EAAEU,kBAAkB,MAAMH,KAAKP,EAAEI,cAAc,EAAA,CAAA;;AAGxD,QAAIO;AACJ,QAAIX,EAAEC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pression", "stringLiteral", "reduce", "acc", "val", "isConditionalExpression", "isNumericLiteral", "logicalExpression", "inner", "isLiteral", "isBinaryExpression", "isIdentifier", "isMemberExpression", "conditionalExpression"]
|
6
|
-
}
|