@tamagui/static 1.0.1-beta.68 → 1.0.1-beta.71
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/cjs/extractor/createEvaluator.js +1 -1
- package/dist/cjs/extractor/createEvaluator.js.map +2 -2
- package/dist/cjs/extractor/createExtractor.js +227 -115
- package/dist/cjs/extractor/createExtractor.js.map +2 -2
- package/dist/cjs/extractor/extractToClassNames.js +17 -31
- package/dist/cjs/extractor/extractToClassNames.js.map +2 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/extractor/createEvaluator.js +1 -1
- package/dist/esm/extractor/createEvaluator.js.map +2 -2
- package/dist/esm/extractor/createExtractor.js +232 -119
- package/dist/esm/extractor/createExtractor.js.map +2 -2
- package/dist/esm/extractor/extractToClassNames.js +17 -31
- package/dist/esm/extractor/extractToClassNames.js.map +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/jsx/extractor/createEvaluator.js +1 -1
- package/dist/jsx/extractor/createExtractor.js +232 -119
- package/dist/jsx/extractor/extractToClassNames.js +17 -31
- package/dist/jsx/index.js +1 -1
- package/package.json +19 -13
- package/src/extractor/createEvaluator.ts +2 -1
- package/src/extractor/createExtractor.ts +356 -161
- package/src/extractor/extractToClassNames.ts +20 -50
- package/src/index.ts +1 -1
- package/src/types.ts +6 -8
- package/types/constants.d.ts +0 -0
- package/types/constants.d.ts.map +0 -0
- package/types/extractor/accessSafe.d.ts +0 -0
- package/types/extractor/accessSafe.d.ts.map +0 -0
- package/types/extractor/babelParse.d.ts +0 -0
- package/types/extractor/babelParse.d.ts.map +0 -0
- package/types/extractor/buildClassName.d.ts +0 -0
- package/types/extractor/buildClassName.d.ts.map +0 -0
- package/types/extractor/createEvaluator.d.ts +1 -1
- package/types/extractor/createEvaluator.d.ts.map +1 -1
- package/types/extractor/createExtractor.d.ts +2 -1
- package/types/extractor/createExtractor.d.ts.map +1 -1
- package/types/extractor/ensureImportingConcat.d.ts +0 -0
- package/types/extractor/ensureImportingConcat.d.ts.map +0 -0
- package/types/extractor/evaluateAstNode.d.ts +0 -0
- package/types/extractor/evaluateAstNode.d.ts.map +0 -0
- package/types/extractor/extractHelpers.d.ts +0 -0
- package/types/extractor/extractHelpers.d.ts.map +0 -0
- package/types/extractor/extractMediaStyle.d.ts +0 -0
- package/types/extractor/extractMediaStyle.d.ts.map +0 -0
- package/types/extractor/extractToClassNames.d.ts +1 -6
- package/types/extractor/extractToClassNames.d.ts.map +1 -1
- package/types/extractor/findTopmostFunction.d.ts +0 -0
- package/types/extractor/findTopmostFunction.d.ts.map +0 -0
- package/types/extractor/generatedUid.d.ts +0 -0
- package/types/extractor/generatedUid.d.ts.map +0 -0
- package/types/extractor/getPrefixLogs.d.ts +0 -0
- package/types/extractor/getPrefixLogs.d.ts.map +0 -0
- package/types/extractor/getPropValueFromAttributes.d.ts +0 -0
- package/types/extractor/getPropValueFromAttributes.d.ts.map +0 -0
- package/types/extractor/getSourceModule.d.ts +0 -0
- package/types/extractor/getSourceModule.d.ts.map +0 -0
- package/types/extractor/getStaticBindingsForScope.d.ts +0 -0
- package/types/extractor/getStaticBindingsForScope.d.ts.map +0 -0
- package/types/extractor/hoistClassNames.d.ts +0 -0
- package/types/extractor/hoistClassNames.d.ts.map +0 -0
- package/types/extractor/literalToAst.d.ts +0 -0
- package/types/extractor/literalToAst.d.ts.map +0 -0
- package/types/extractor/loadTamagui.d.ts +0 -0
- package/types/extractor/loadTamagui.d.ts.map +0 -0
- package/types/extractor/logLines.d.ts +0 -0
- package/types/extractor/logLines.d.ts.map +0 -0
- package/types/extractor/normalizeTernaries.d.ts +0 -0
- package/types/extractor/normalizeTernaries.d.ts.map +0 -0
- package/types/extractor/removeUnusedHooks.d.ts +0 -0
- package/types/extractor/removeUnusedHooks.d.ts.map +0 -0
- package/types/extractor/timer.d.ts +0 -0
- package/types/extractor/timer.d.ts.map +0 -0
- package/types/extractor/validHTMLAttributes.d.ts +0 -0
- package/types/extractor/validHTMLAttributes.d.ts.map +0 -0
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +4 -7
- package/types/types.d.ts.map +1 -1
- package/dist/cjs/patchReactNativeWeb.js +0 -167
- package/dist/cjs/patchReactNativeWeb.js.map +0 -7
- package/dist/esm/patchReactNativeWeb.js +0 -142
- package/dist/esm/patchReactNativeWeb.js.map +0 -7
- package/dist/jsx/patchReactNativeWeb.js +0 -141
- package/src/patchReactNativeWeb.ts +0 -165
- package/types/patchReactNativeWeb.d.ts +0 -2
- package/types/patchReactNativeWeb.d.ts.map +0 -1
|
@@ -20,7 +20,6 @@ import { isSimpleSpread } from './extractHelpers'
|
|
|
20
20
|
import { extractMediaStyle } from './extractMediaStyle'
|
|
21
21
|
import { getPrefixLogs } from './getPrefixLogs'
|
|
22
22
|
import { hoistClassNames } from './hoistClassNames'
|
|
23
|
-
import { literalToAst } from './literalToAst'
|
|
24
23
|
import { logLines } from './logLines'
|
|
25
24
|
import { timer } from './timer'
|
|
26
25
|
|
|
@@ -40,25 +39,17 @@ export type ExtractedResponse = {
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
export function extractToClassNames({
|
|
43
|
-
loader,
|
|
44
42
|
extractor,
|
|
45
43
|
source,
|
|
46
44
|
sourcePath,
|
|
47
45
|
options,
|
|
48
46
|
shouldPrintDebug,
|
|
49
|
-
cssLoaderPath,
|
|
50
|
-
threaded,
|
|
51
|
-
cssPath,
|
|
52
47
|
}: {
|
|
53
|
-
loader: LoaderContext<any>
|
|
54
|
-
cssLoaderPath: string
|
|
55
48
|
extractor: Extractor
|
|
56
49
|
source: string | Buffer
|
|
57
50
|
sourcePath: string
|
|
58
51
|
options: TamaguiOptions
|
|
59
52
|
shouldPrintDebug: boolean | 'verbose'
|
|
60
|
-
cssPath: string
|
|
61
|
-
threaded?: boolean
|
|
62
53
|
}): ExtractedResponse | null {
|
|
63
54
|
const tm = timer()
|
|
64
55
|
|
|
@@ -78,7 +69,6 @@ export function extractToClassNames({
|
|
|
78
69
|
let ast: t.File
|
|
79
70
|
|
|
80
71
|
try {
|
|
81
|
-
// @ts-ignore
|
|
82
72
|
ast = babelParse(source)
|
|
83
73
|
} catch (err) {
|
|
84
74
|
console.error('babel parse error:', sourcePath)
|
|
@@ -97,6 +87,10 @@ export function extractToClassNames({
|
|
|
97
87
|
shouldPrintDebug,
|
|
98
88
|
...options,
|
|
99
89
|
target: 'html',
|
|
90
|
+
extractStyledDefinitions: true,
|
|
91
|
+
onStyleRule(identifier, rules) {
|
|
92
|
+
cssMap.set(`.${identifier}`, { css: rules.join(';'), commentTexts: [] })
|
|
93
|
+
},
|
|
100
94
|
getFlattenedNode: ({ tag }) => {
|
|
101
95
|
hasFlattened = true
|
|
102
96
|
return tag
|
|
@@ -112,6 +106,10 @@ export function extractToClassNames({
|
|
|
112
106
|
programPath,
|
|
113
107
|
isFlattened,
|
|
114
108
|
}) => {
|
|
109
|
+
// reset hasFlattened
|
|
110
|
+
const didFlattenThisTag = hasFlattened
|
|
111
|
+
hasFlattened = false
|
|
112
|
+
|
|
115
113
|
let finalClassNames: ClassNameObject[] = []
|
|
116
114
|
let finalAttrs: (t.JSXAttribute | t.JSXSpreadAttribute)[] = []
|
|
117
115
|
let finalStyles: StyleObject[] = []
|
|
@@ -156,37 +154,17 @@ export function extractToClassNames({
|
|
|
156
154
|
switch (attr.type) {
|
|
157
155
|
case 'style':
|
|
158
156
|
if (!isFlattened) {
|
|
159
|
-
// only ever one at a time i believe so we can be lazy with this access
|
|
160
|
-
const { hoverStyle, pressStyle, focusStyle } = attr.value
|
|
161
|
-
const pseudos = [
|
|
162
|
-
['hoverStyle', hoverStyle],
|
|
163
|
-
['pressStyle', pressStyle],
|
|
164
|
-
['focusStyle', focusStyle],
|
|
165
|
-
] as const
|
|
166
|
-
|
|
167
157
|
const styles = getStylesAtomic(attr.value, {
|
|
168
158
|
splitTransforms: true,
|
|
169
159
|
})
|
|
170
|
-
finalStyles = [...finalStyles, ...styles]
|
|
171
160
|
|
|
172
|
-
|
|
173
|
-
if (value && Object.keys(value).length) {
|
|
174
|
-
finalAttrs.push(
|
|
175
|
-
t.jsxAttribute(
|
|
176
|
-
t.jsxIdentifier(key),
|
|
177
|
-
t.jsxExpressionContainer(literalToAst(value))
|
|
178
|
-
)
|
|
179
|
-
)
|
|
180
|
-
}
|
|
181
|
-
}
|
|
161
|
+
finalStyles = [...finalStyles, ...styles]
|
|
182
162
|
|
|
183
163
|
for (const style of styles) {
|
|
184
|
-
if (style.pseudo) {
|
|
185
|
-
continue
|
|
186
|
-
}
|
|
187
164
|
// leave them as attributes
|
|
165
|
+
const prop = style.pseudo ? `${style.property}-${style.pseudo}` : style.property
|
|
188
166
|
finalAttrs.push(
|
|
189
|
-
t.jsxAttribute(t.jsxIdentifier(
|
|
167
|
+
t.jsxAttribute(t.jsxIdentifier(prop), t.stringLiteral(style.identifier))
|
|
190
168
|
)
|
|
191
169
|
}
|
|
192
170
|
} else {
|
|
@@ -305,7 +283,7 @@ export function extractToClassNames({
|
|
|
305
283
|
|
|
306
284
|
// if has some spreads, use concat helper
|
|
307
285
|
if (nameExpr && !t.isIdentifier(nameExpr)) {
|
|
308
|
-
if (!
|
|
286
|
+
if (!didFlattenThisTag) {
|
|
309
287
|
// not flat
|
|
310
288
|
} else {
|
|
311
289
|
ensureImportingConcat(programPath)
|
|
@@ -326,7 +304,8 @@ export function extractToClassNames({
|
|
|
326
304
|
|
|
327
305
|
const comment = util.format('/* %s:%s (%s) */', filePath, lineNumbers, originalNodeName)
|
|
328
306
|
|
|
329
|
-
for (const {
|
|
307
|
+
for (const { identifier, rules } of finalStyles) {
|
|
308
|
+
const className = `.${identifier}`
|
|
330
309
|
if (cssMap.has(className)) {
|
|
331
310
|
if (comment) {
|
|
332
311
|
const val = cssMap.get(className)!
|
|
@@ -347,7 +326,7 @@ export function extractToClassNames({
|
|
|
347
326
|
},
|
|
348
327
|
})
|
|
349
328
|
|
|
350
|
-
if (!res || (!res.modified && !res.optimized && !res.flattened)) {
|
|
329
|
+
if (!res || (!res.modified && !res.optimized && !res.flattened && !res.styled)) {
|
|
351
330
|
if (shouldPrintDebug) {
|
|
352
331
|
console.log('no res or none modified', res)
|
|
353
332
|
}
|
|
@@ -359,15 +338,6 @@ export function extractToClassNames({
|
|
|
359
338
|
.join('\n')
|
|
360
339
|
.trim()
|
|
361
340
|
|
|
362
|
-
if (styles) {
|
|
363
|
-
const cssQuery = threaded
|
|
364
|
-
? `cssData=${Buffer.from(styles).toString('base64')}`
|
|
365
|
-
: `cssPath=${cssPath}`
|
|
366
|
-
const remReq = loader.remainingRequest
|
|
367
|
-
const importPath = `${cssPath}!=!${cssLoaderPath}?${cssQuery}!${remReq}`
|
|
368
|
-
ast.program.body.unshift(t.importDeclaration([], t.stringLiteral(importPath)))
|
|
369
|
-
}
|
|
370
|
-
|
|
371
341
|
const result = generate(
|
|
372
342
|
ast,
|
|
373
343
|
{
|
|
@@ -401,6 +371,8 @@ export function extractToClassNames({
|
|
|
401
371
|
.slice(0, 22)
|
|
402
372
|
.trim()
|
|
403
373
|
.padStart(24)
|
|
374
|
+
|
|
375
|
+
const numStyled = `${res.styled}`.padStart(3)
|
|
404
376
|
const numOptimized = `${res.optimized}`.padStart(3)
|
|
405
377
|
const numFound = `${res.found}`.padStart(3)
|
|
406
378
|
const numFlattened = `${res.flattened}`.padStart(3)
|
|
@@ -408,12 +380,10 @@ export function extractToClassNames({
|
|
|
408
380
|
const timing = Date.now() - start
|
|
409
381
|
const timingWarning = timing > 50 ? '⚠️' : timing > 150 ? '☢️' : ''
|
|
410
382
|
const timingStr = `${timing}ms${timingWarning}`.padStart(6)
|
|
383
|
+
const pre = getPrefixLogs(options)
|
|
384
|
+
const memStr = memory ? `(${memory})` : ''
|
|
411
385
|
console.log(
|
|
412
|
-
`${
|
|
413
|
-
options
|
|
414
|
-
)} ${path} ${numFound} · ${numOptimized} · ${numFlattened} ${timingStr} ${
|
|
415
|
-
memory ? `(${memory})` : ''
|
|
416
|
-
}`
|
|
386
|
+
`${pre} ${path} ${numFound} · ${numOptimized} · ${numFlattened} · ${numStyled} ${timingStr} ${memStr}`
|
|
417
387
|
)
|
|
418
388
|
}
|
|
419
389
|
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { NodePath } from '@babel/traverse'
|
|
2
2
|
import * as t from '@babel/types'
|
|
3
3
|
import { PseudoStyles } from '@tamagui/core-node'
|
|
4
|
+
import { StyleObject } from '@tamagui/core-node'
|
|
4
5
|
import { ViewStyle } from 'react-native'
|
|
5
6
|
|
|
7
|
+
export type { StyleObject } from '@tamagui/helpers'
|
|
8
|
+
|
|
6
9
|
export type ClassNameObject = t.StringLiteral | t.Expression
|
|
7
10
|
|
|
8
11
|
export interface CacheObject {
|
|
@@ -69,6 +72,9 @@ export type ExtractorParseProps = TamaguiOptions & {
|
|
|
69
72
|
shouldPrintDebug?: boolean | 'verbose'
|
|
70
73
|
onExtractTag: (props: ExtractTagProps) => void
|
|
71
74
|
getFlattenedNode: (props: { isTextView: boolean; tag: string }) => string
|
|
75
|
+
extractStyledDefinitions?: boolean
|
|
76
|
+
// identifer, rule
|
|
77
|
+
onStyleRule?: (identifier: string, rules: string[]) => void
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
export interface Ternary {
|
|
@@ -80,14 +86,6 @@ export interface Ternary {
|
|
|
80
86
|
alternate: Object | null
|
|
81
87
|
}
|
|
82
88
|
|
|
83
|
-
export type StyleObject = {
|
|
84
|
-
property: string
|
|
85
|
-
value: string
|
|
86
|
-
className: string
|
|
87
|
-
identifier: string
|
|
88
|
-
rules: string[]
|
|
89
|
-
}
|
|
90
|
-
|
|
91
89
|
export type ClassNameToStyleObj = {
|
|
92
90
|
[key: string]: StyleObject
|
|
93
91
|
}
|
package/types/constants.d.ts
CHANGED
|
File without changes
|
package/types/constants.d.ts.map
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -5,7 +5,7 @@ export declare function createEvaluator({ tamaguiConfig, staticNamespace, source
|
|
|
5
5
|
tamaguiConfig: TamaguiConfig;
|
|
6
6
|
staticNamespace: Record<string, any>;
|
|
7
7
|
sourcePath: string;
|
|
8
|
-
traversePath
|
|
8
|
+
traversePath?: NodePath<t.JSXElement>;
|
|
9
9
|
shouldPrintDebug: boolean | 'verbose';
|
|
10
10
|
}): (n: t.Node) => any;
|
|
11
11
|
export declare function createSafeEvaluator(attemptEval: (n: t.Node) => any): (n: t.Node) => any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createEvaluator.d.ts","sourceRoot":"","sources":["../../src/extractor/createEvaluator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAQlD,wBAAgB,eAAe,CAAC,EAC9B,aAAa,EACb,eAAe,EACf,UAAU,EACV,YAAY,EACZ,gBAAgB,GACjB,EAAE;IACD,aAAa,EAAE,aAAa,CAAA;IAC5B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"createEvaluator.d.ts","sourceRoot":"","sources":["../../src/extractor/createEvaluator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAQlD,wBAAgB,eAAe,CAAC,EAC9B,aAAa,EACb,eAAe,EACf,UAAU,EACV,YAAY,EACZ,gBAAgB,GACjB,EAAE;IACD,aAAa,EAAE,aAAa,CAAA;IAC5B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;IACrC,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;CACtC,OAoCY,MAAM,SAGlB;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,GAAG,OACtD,MAAM,SAOlB"}
|
|
@@ -17,7 +17,8 @@ export declare function createExtractor(): {
|
|
|
17
17
|
[key: string]: any;
|
|
18
18
|
};
|
|
19
19
|
}, import("@tamagui/core-node").GenericFonts>;
|
|
20
|
-
parse: (fileOrPath: NodePath<t.Program> | t.File, { config, importsWhitelist, evaluateVars, shouldPrintDebug, sourcePath, onExtractTag, getFlattenedNode, disable, disableExtraction, disableExtractInlineMedia, disableExtractVariables, disableDebugAttr, prefixLogs, excludeProps, target, ...props }: ExtractorParseProps) => {
|
|
20
|
+
parse: (fileOrPath: NodePath<t.Program> | t.File, { config, importsWhitelist, evaluateVars, shouldPrintDebug, sourcePath, onExtractTag, onStyleRule, getFlattenedNode, disable, disableExtraction, disableExtractInlineMedia, disableExtractVariables, disableDebugAttr, extractStyledDefinitions, prefixLogs, excludeProps, target, ...props }: ExtractorParseProps) => {
|
|
21
|
+
styled: number;
|
|
21
22
|
flattened: number;
|
|
22
23
|
optimized: number;
|
|
23
24
|
modified: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createExtractor.d.ts","sourceRoot":"","sources":["../../src/extractor/createExtractor.ts"],"names":[],"mappings":"AAEA,OAAiB,EAAE,QAAQ,EAAW,MAAM,iBAAiB,CAAA;AAC7D,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAGL,qBAAqB,
|
|
1
|
+
{"version":3,"file":"createExtractor.d.ts","sourceRoot":"","sources":["../../src/extractor/createExtractor.ts"],"names":[],"mappings":"AAEA,OAAiB,EAAE,QAAQ,EAAW,MAAM,iBAAiB,CAAA;AAC7D,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAGL,qBAAqB,EAUtB,MAAM,oBAAoB,CAAA;AAK3B,OAAO,EAIL,mBAAmB,EAEpB,MAAM,UAAU,CAAA;AAqCjB,oBAAY,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAI1D,wBAAgB,eAAe;;;;;;;;;;;;;;wBAkCb,SAAS,EAAE,OAAO,CAAC,GAAG,MAAM,iSAoBrC,mBAAmB;;;;;;;EAswD3B"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as t from '@babel/types';
|
|
3
|
-
import { LoaderContext } from 'webpack';
|
|
4
3
|
import { TamaguiOptions } from '../types';
|
|
5
4
|
import { Extractor } from './createExtractor';
|
|
6
5
|
export declare type ExtractedResponse = {
|
|
@@ -10,15 +9,11 @@ export declare type ExtractedResponse = {
|
|
|
10
9
|
ast: t.File;
|
|
11
10
|
map: any;
|
|
12
11
|
};
|
|
13
|
-
export declare function extractToClassNames({
|
|
14
|
-
loader: LoaderContext<any>;
|
|
15
|
-
cssLoaderPath: string;
|
|
12
|
+
export declare function extractToClassNames({ extractor, source, sourcePath, options, shouldPrintDebug, }: {
|
|
16
13
|
extractor: Extractor;
|
|
17
14
|
source: string | Buffer;
|
|
18
15
|
sourcePath: string;
|
|
19
16
|
options: TamaguiOptions;
|
|
20
17
|
shouldPrintDebug: boolean | 'verbose';
|
|
21
|
-
cssPath: string;
|
|
22
|
-
threaded?: boolean;
|
|
23
18
|
}): ExtractedResponse | null;
|
|
24
19
|
//# sourceMappingURL=extractToClassNames.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractToClassNames.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToClassNames.ts"],"names":[],"mappings":";AAKA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"extractToClassNames.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToClassNames.ts"],"names":[],"mappings":";AAKA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAQjC,OAAO,EAAgC,cAAc,EAAW,MAAM,UAAU,CAAA;AAGhF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAgB7C,oBAAY,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,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,cAAc,CAAA;IACvB,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;CACtC,GAAG,iBAAiB,GAAG,IAAI,CAuV3B"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/types/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export { literalToAst } from './extractor/literalToAst';
|
|
|
4
4
|
export * from './constants';
|
|
5
5
|
export * from './extractor/extractToClassNames';
|
|
6
6
|
export * from './extractor/extractHelpers';
|
|
7
|
-
export * from '
|
|
7
|
+
export * from '@tamagui/patch-rnw';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oBAAoB,CAAA"}
|
package/types/types.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { NodePath } from '@babel/traverse';
|
|
2
2
|
import * as t from '@babel/types';
|
|
3
3
|
import { PseudoStyles } from '@tamagui/core-node';
|
|
4
|
+
import { StyleObject } from '@tamagui/core-node';
|
|
4
5
|
import { ViewStyle } from 'react-native';
|
|
6
|
+
export type { StyleObject } from '@tamagui/helpers';
|
|
5
7
|
export declare type ClassNameObject = t.StringLiteral | t.Expression;
|
|
6
8
|
export interface CacheObject {
|
|
7
9
|
[key: string]: any;
|
|
@@ -60,6 +62,8 @@ export declare type ExtractorParseProps = TamaguiOptions & {
|
|
|
60
62
|
isTextView: boolean;
|
|
61
63
|
tag: string;
|
|
62
64
|
}) => string;
|
|
65
|
+
extractStyledDefinitions?: boolean;
|
|
66
|
+
onStyleRule?: (identifier: string, rules: string[]) => void;
|
|
63
67
|
};
|
|
64
68
|
export interface Ternary {
|
|
65
69
|
test: t.Expression;
|
|
@@ -68,13 +72,6 @@ export interface Ternary {
|
|
|
68
72
|
consequent: Object | null;
|
|
69
73
|
alternate: Object | null;
|
|
70
74
|
}
|
|
71
|
-
export declare type StyleObject = {
|
|
72
|
-
property: string;
|
|
73
|
-
value: string;
|
|
74
|
-
className: string;
|
|
75
|
-
identifier: string;
|
|
76
|
-
rules: string[];
|
|
77
|
-
};
|
|
78
75
|
export declare type ClassNameToStyleObj = {
|
|
79
76
|
[key: string]: StyleObject;
|
|
80
77
|
};
|
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,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,oBAAY,eAAe,GAAG,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,UAAU,CAAA;AAE5D,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB;AAED,MAAM,WAAW,cAAc;IAE7B,UAAU,EAAE,MAAM,E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AAO;IACtB,IAAI,EAAE,CAAC,CAAC,UAAU,CAAA;IAElB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,MAAM,EAAE,QAAQ,CAAA;IAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,oBAAY,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,167 +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;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
21
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
-
var patchReactNativeWeb_exports = {};
|
|
23
|
-
__export(patchReactNativeWeb_exports, {
|
|
24
|
-
patchReactNativeWeb: () => patchReactNativeWeb
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(patchReactNativeWeb_exports);
|
|
27
|
-
var import_path = __toESM(require("path"));
|
|
28
|
-
var fs = __toESM(require("fs-extra"));
|
|
29
|
-
function patchReactNativeWeb(dir = require.resolve("react-native-web")) {
|
|
30
|
-
const rootDir = dir.replace(/[\/\\]dist.*/, "");
|
|
31
|
-
const modulePath = import_path.default.join(rootDir, "dist", "tamagui-exports.js");
|
|
32
|
-
const cjsPath = import_path.default.join(rootDir, "dist", "cjs", "tamagui-exports.js");
|
|
33
|
-
const shouldPatchExports = fs.existsSync(modulePath) && fs.readFileSync(modulePath, "utf-8") === moduleExports && fs.existsSync(cjsPath) && fs.readFileSync(cjsPath, "utf-8") === cjsExports;
|
|
34
|
-
if (!shouldPatchExports) {
|
|
35
|
-
console.log(" | patch " + import_path.default.relative(rootDir, modulePath));
|
|
36
|
-
console.log(" | patch " + import_path.default.relative(rootDir, cjsPath));
|
|
37
|
-
fs.writeFileSync(modulePath, moduleExports);
|
|
38
|
-
fs.writeFileSync(cjsPath, cjsExports);
|
|
39
|
-
}
|
|
40
|
-
const patches = [
|
|
41
|
-
{
|
|
42
|
-
id: "dom-props",
|
|
43
|
-
filePath: ["modules", "createDOMProps", "index.js"],
|
|
44
|
-
replacee: ` if (dataSet != null) {`,
|
|
45
|
-
replacer: `
|
|
46
|
-
if (props.dataSet && props.dataSet.className) {
|
|
47
|
-
const { className, ...dataSetRest } = props.dataSet
|
|
48
|
-
classList = className
|
|
49
|
-
dataSet = dataSetRest
|
|
50
|
-
}
|
|
51
|
-
if (props.dataSet && props.dataSet.id) {
|
|
52
|
-
domProps['id'] = props.dataSet.id
|
|
53
|
-
}
|
|
54
|
-
if (dataSet != null) {`
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
id: "forward-props",
|
|
58
|
-
filePath: ["modules", "forwardedProps", "index.js"],
|
|
59
|
-
replacee: `dataSet: true,`,
|
|
60
|
-
replacer: `id: true, dataSet: true,`
|
|
61
|
-
}
|
|
62
|
-
];
|
|
63
|
-
for (const { filePath, replacee, replacer } of patches) {
|
|
64
|
-
const files = [
|
|
65
|
-
import_path.default.join(rootDir, "dist", ...filePath),
|
|
66
|
-
import_path.default.join(rootDir, "dist", "cjs", ...filePath)
|
|
67
|
-
];
|
|
68
|
-
for (const file of files) {
|
|
69
|
-
const contents = fs.readFileSync(file, "utf-8");
|
|
70
|
-
if (contents.includes(replacer)) {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
if (!contents.includes(replacee)) {
|
|
74
|
-
console.warn(`\u26A0\uFE0F Error: couldn't apply className patch! Maybe using incompatible react-native-web version.`, {
|
|
75
|
-
replacee,
|
|
76
|
-
contents
|
|
77
|
-
});
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
console.log(" | patch " + import_path.default.relative(rootDir, file));
|
|
81
|
-
fs.writeFileSync(file, contents.replace(replacee, replacer));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
const moduleEntry = import_path.default.join(rootDir, "dist", "index.js");
|
|
85
|
-
const moduleEntrySrc = fs.readFileSync(moduleEntry, "utf-8");
|
|
86
|
-
if (!moduleEntrySrc.includes("// tamagui-patch-v4")) {
|
|
87
|
-
fs.writeFileSync(moduleEntry, `${removePatch(moduleEntrySrc)}
|
|
88
|
-
|
|
89
|
-
// tamagui-patch-v4
|
|
90
|
-
import * as TExports from './tamagui-exports'
|
|
91
|
-
export const TamaguiExports = TExports
|
|
92
|
-
// tamagui-patch-end
|
|
93
|
-
`);
|
|
94
|
-
}
|
|
95
|
-
const cjsEntry = import_path.default.join(rootDir, "dist", "cjs", "index.js");
|
|
96
|
-
const cjsEntrySrc = fs.readFileSync(cjsEntry, "utf-8");
|
|
97
|
-
if (!cjsEntrySrc.includes("// tamagui-patch-v4")) {
|
|
98
|
-
fs.writeFileSync(cjsEntry, `${removePatch(cjsEntrySrc)}
|
|
99
|
-
|
|
100
|
-
// tamagui-patch-v4
|
|
101
|
-
exports.TamaguiExports = _interopRequireDefault(require("./tamagui-exports"));
|
|
102
|
-
// tamagui-patch-end
|
|
103
|
-
`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
__name(patchReactNativeWeb, "patchReactNativeWeb");
|
|
107
|
-
function removePatch(source) {
|
|
108
|
-
return source.replace(/\/\/ tamagui-patch([.\s\S]*)/g, "");
|
|
109
|
-
}
|
|
110
|
-
__name(removePatch, "removePatch");
|
|
111
|
-
const forwardedPropsObj = `{
|
|
112
|
-
...fwdProps.defaultProps,
|
|
113
|
-
...fwdProps.accessibilityProps,
|
|
114
|
-
...fwdProps.clickProps,
|
|
115
|
-
...fwdProps.focusProps,
|
|
116
|
-
...fwdProps.keyboardProps,
|
|
117
|
-
...fwdProps.mouseProps,
|
|
118
|
-
...fwdProps.touchProps,
|
|
119
|
-
...fwdProps.styleProps,
|
|
120
|
-
href: true,
|
|
121
|
-
lang: true,
|
|
122
|
-
onScroll: true,
|
|
123
|
-
onWheel: true,
|
|
124
|
-
pointerEvents: true
|
|
125
|
-
}
|
|
126
|
-
`;
|
|
127
|
-
const moduleExports = `
|
|
128
|
-
export { atomic } from './exports/StyleSheet/compile'
|
|
129
|
-
export { default as createCompileableStyle } from './exports/StyleSheet/createCompileableStyle'
|
|
130
|
-
export { default as createReactDOMStyle } from './exports/StyleSheet/createReactDOMStyle'
|
|
131
|
-
export { default as i18Style } from './exports/StyleSheet/i18nStyle'
|
|
132
|
-
export { default as createDOMProps } from './modules/createDOMProps'
|
|
133
|
-
export { default as AccessibilityUtil } from './modules/AccessibilityUtil'
|
|
134
|
-
export { default as createElement } from './exports/createElement'
|
|
135
|
-
export { default as css } from './exports/StyleSheet/css'
|
|
136
|
-
export { default as TextAncestorContext } from './exports/Text/TextAncestorContext'
|
|
137
|
-
export { default as pick } from './modules/pick'
|
|
138
|
-
export { default as useElementLayout } from './modules/useElementLayout'
|
|
139
|
-
export { default as useMergeRefs } from './modules/useMergeRefs'
|
|
140
|
-
export { default as usePlatformMethods } from './modules/usePlatformMethods'
|
|
141
|
-
export { default as useResponderEvents } from './modules/useResponderEvents'
|
|
142
|
-
import * as fwdProps from './modules/forwardedProps'
|
|
143
|
-
export const forwardedProps = ${forwardedPropsObj}
|
|
144
|
-
`;
|
|
145
|
-
const cjsExports = `
|
|
146
|
-
exports.atomic = require('./exports/StyleSheet/compile').atomic
|
|
147
|
-
exports.createCompileableStyle = require('./exports/StyleSheet/createCompileableStyle')
|
|
148
|
-
exports.createReactDOMStyle = require('./exports/StyleSheet/createReactDOMStyle')
|
|
149
|
-
exports.i18Style = require('./exports/StyleSheet/i18nStyle')
|
|
150
|
-
exports.createDOMProps = require('./modules/createDOMProps')
|
|
151
|
-
exports.AccessibilityUtil = require('./modules/AccessibilityUtil')
|
|
152
|
-
exports.createElement = require('./exports/createElement')
|
|
153
|
-
exports.css = require('./exports/StyleSheet/css')
|
|
154
|
-
exports.TextAncestorContext = require('./exports/Text/TextAncestorContext')
|
|
155
|
-
exports.pick = require('./modules/pick')
|
|
156
|
-
exports.useElementLayout = require('./modules/useElementLayout')
|
|
157
|
-
exports.useMergeRefs = require('./modules/useMergeRefs')
|
|
158
|
-
exports.usePlatformMethods = require('./modules/usePlatformMethods')
|
|
159
|
-
exports.useResponderEvents = require('./modules/useResponderEvents')
|
|
160
|
-
const fwdProps = require('./modules/forwardedProps')
|
|
161
|
-
exports.forwardedProps = ${forwardedPropsObj}
|
|
162
|
-
`;
|
|
163
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
164
|
-
0 && (module.exports = {
|
|
165
|
-
patchReactNativeWeb
|
|
166
|
-
});
|
|
167
|
-
//# sourceMappingURL=patchReactNativeWeb.js.map
|