@tamagui/static 1.0.1-rc.1.4 → 1.0.1-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.js.map +2 -2
- package/dist/extractor/buildClassName.js +0 -2
- package/dist/extractor/buildClassName.js.map +2 -2
- package/dist/extractor/createEvaluator.js.map +1 -1
- package/dist/extractor/createExtractor.js +3 -5
- package/dist/extractor/createExtractor.js.map +2 -2
- package/dist/extractor/extractHelpers.js +1 -1
- package/dist/extractor/extractHelpers.js.map +2 -2
- package/dist/extractor/extractMediaStyle.js.map +1 -1
- package/dist/extractor/extractToClassNames.js +7 -24
- package/dist/extractor/extractToClassNames.js.map +3 -3
- package/dist/extractor/generatedUid.js +4 -6
- package/dist/extractor/generatedUid.js.map +3 -3
- package/dist/types.js.map +1 -1
- package/package.json +15 -15
- package/src/constants.ts +0 -1
- package/src/extractor/buildClassName.ts +1 -2
- package/src/extractor/createEvaluator.ts +1 -1
- package/src/extractor/createExtractor.ts +7 -7
- package/src/extractor/extractHelpers.ts +2 -2
- package/src/extractor/extractMediaStyle.ts +1 -1
- package/src/extractor/extractToClassNames.ts +8 -27
- package/src/extractor/generatedUid.ts +4 -5
- package/src/types.ts +1 -1
- package/types/extractor/createEvaluator.d.ts +1 -1
- package/types/extractor/extractHelpers.d.ts +1 -1
- package/types/extractor/extractToClassNames.d.ts +1 -1
- package/types/types.d.ts +1 -1
- package/src/extractor/ensureImportingConcat.ts +0 -32
|
@@ -8,11 +8,10 @@ declare module '@babel/types' {
|
|
|
8
8
|
|
|
9
9
|
// A clone of path.scope.generateUid that doesn't prepend underscores
|
|
10
10
|
export function generateUid(scope: any, name: string): string {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'generateUid expects a valid name as its second parameter'
|
|
15
|
-
)
|
|
11
|
+
if (!(typeof scope === 'object'))
|
|
12
|
+
throw 'generateUid expects a scope object as its first parameter'
|
|
13
|
+
if (!(typeof name === 'string' && name !== ''))
|
|
14
|
+
throw 'generateUid expects a valid name as its second parameter'
|
|
16
15
|
|
|
17
16
|
name = t
|
|
18
17
|
.toIdentifier(name)
|
package/src/types.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { TamaguiOptionsWithFileInfo } from '../types.js';
|
|
|
4
4
|
export declare function createEvaluator({ props, staticNamespace, sourcePath, traversePath, shouldPrintDebug, }: {
|
|
5
5
|
props: TamaguiOptionsWithFileInfo;
|
|
6
6
|
staticNamespace: Record<string, any>;
|
|
7
|
-
sourcePath
|
|
7
|
+
sourcePath?: string;
|
|
8
8
|
traversePath?: NodePath<t.JSXElement>;
|
|
9
9
|
shouldPrintDebug: boolean | 'verbose';
|
|
10
10
|
}): (n: t.Node) => any;
|
|
@@ -7,7 +7,7 @@ export declare const attrStr: (attr?: ExtractedAttr) => string | t.JSXIdentifier
|
|
|
7
7
|
export declare const objToStr: (obj: any, spacer?: string) => any;
|
|
8
8
|
export declare const ternaryStr: (x: Ternary) => string;
|
|
9
9
|
export declare function findComponentName(scope: any): string | undefined;
|
|
10
|
-
export declare function isValidThemeHook(props: TamaguiOptionsWithFileInfo, jsxPath: NodePath<t.JSXElement>, n: t.MemberExpression, sourcePath
|
|
10
|
+
export declare function isValidThemeHook(props: TamaguiOptionsWithFileInfo, jsxPath: NodePath<t.JSXElement>, n: t.MemberExpression, sourcePath?: string): boolean;
|
|
11
11
|
export declare const isInsideComponentPackage: (props: TamaguiOptionsWithFileInfo, moduleName: string) => any;
|
|
12
12
|
export declare const isComponentPackage: (props: TamaguiOptionsWithFileInfo, srcName: string) => any;
|
|
13
13
|
export declare function getValidComponent(props: TamaguiOptionsWithFileInfo, moduleName: string, componentName: string): false | {
|
package/types/types.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export type ExtractTagProps = {
|
|
|
53
53
|
staticConfig: StaticConfig;
|
|
54
54
|
};
|
|
55
55
|
export type TamaguiOptionsWithFileInfo = TamaguiOptions & {
|
|
56
|
-
sourcePath
|
|
56
|
+
sourcePath?: string;
|
|
57
57
|
allLoadedComponents: LoadedComponents[];
|
|
58
58
|
};
|
|
59
59
|
export type ExtractorParseProps = Omit<TamaguiOptionsWithFileInfo, 'allLoadedComponents'> & {
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { NodePath } from '@babel/traverse'
|
|
2
|
-
import * as t from '@babel/types'
|
|
3
|
-
|
|
4
|
-
const importConcatPkg = '@tamagui/helpers'
|
|
5
|
-
|
|
6
|
-
export function ensureImportingConcat(path: NodePath<t.Program>) {
|
|
7
|
-
const bodyPath = path.get('body')
|
|
8
|
-
const imported: NodePath<t.ImportDeclaration> | undefined = bodyPath.find(
|
|
9
|
-
(x) => x.isImportDeclaration() && x.node.source.value === importConcatPkg
|
|
10
|
-
) as any
|
|
11
|
-
const importSpecifier = t.importSpecifier(
|
|
12
|
-
t.identifier('concatClassName'),
|
|
13
|
-
t.identifier('concatClassName')
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
if (!imported) {
|
|
17
|
-
path.node.body.push(t.importDeclaration([importSpecifier], t.stringLiteral(importConcatPkg)))
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const specifiers = imported.node.specifiers
|
|
22
|
-
const alreadyImported = specifiers.some(
|
|
23
|
-
(x) =>
|
|
24
|
-
t.isImportSpecifier(x) && t.isIdentifier(x.imported) && x.imported.name === 'concatClassName'
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
if (!alreadyImported) {
|
|
28
|
-
specifiers.push(
|
|
29
|
-
t.importSpecifier(t.identifier('concatClassName'), t.identifier('concatClassName'))
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
}
|