@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.
@@ -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
- invariant(typeof scope === 'object', 'generateUid expects a scope object as its first parameter')
12
- invariant(
13
- typeof name === 'string' && name !== '',
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
@@ -66,7 +66,7 @@ export type ExtractTagProps = {
66
66
  }
67
67
 
68
68
  export type TamaguiOptionsWithFileInfo = TamaguiOptions & {
69
- sourcePath: string
69
+ sourcePath?: string
70
70
  allLoadedComponents: LoadedComponents[]
71
71
  }
72
72
 
@@ -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: string;
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: string): boolean;
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 | {
@@ -12,7 +12,7 @@ export type ExtractedResponse = {
12
12
  export type ExtractToClassNamesProps = {
13
13
  extractor: Extractor;
14
14
  source: string | Buffer;
15
- sourcePath: string;
15
+ sourcePath?: string;
16
16
  options: TamaguiOptions;
17
17
  shouldPrintDebug: boolean | 'verbose';
18
18
  };
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: string;
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
- }