@tamagui/helpers-node 1.0.1-beta.161

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.
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var getDefaultTamaguiOptions_exports = {};
20
+ __export(getDefaultTamaguiOptions_exports, {
21
+ getDefaultTamaguiOptions: () => getDefaultTamaguiOptions
22
+ });
23
+ module.exports = __toCommonJS(getDefaultTamaguiOptions_exports);
24
+ var import_getTamaguiDefaultPath = require("./getTamaguiDefaultPath");
25
+ async function getDefaultTamaguiOptions({
26
+ cwd = "."
27
+ }) {
28
+ return {
29
+ components: ["tamagui"],
30
+ config: await (0, import_getTamaguiDefaultPath.getDefaultTamaguiConfigPath)({ cwd })
31
+ };
32
+ }
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ getDefaultTamaguiOptions
36
+ });
37
+ //# sourceMappingURL=getDefaultTamaguiOptions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/getDefaultTamaguiOptions.ts"],
4
+ "sourcesContent": ["import { getDefaultTamaguiConfigPath } from './getTamaguiDefaultPath'\nimport type { TamaguiOptions } from './types'\n\nexport async function getDefaultTamaguiOptions({\n cwd = '.',\n}: {\n cwd: string\n}): Promise<TamaguiOptions> {\n return {\n components: ['tamagui'],\n config: await getDefaultTamaguiConfigPath({ cwd }),\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAA4C;AAG5C,eAAsB,yBAAyB;AAAA,EAC7C,MAAM;AACR,GAE4B;AAC1B,SAAO;AAAA,IACL,YAAY,CAAC,SAAS;AAAA,IACtB,QAAQ,UAAM,0DAA4B,EAAE,IAAI,CAAC;AAAA,EACnD;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var getTamaguiDefaultPath_exports = {};
20
+ __export(getTamaguiDefaultPath_exports, {
21
+ getDefaultTamaguiConfigPath: () => getDefaultTamaguiConfigPath
22
+ });
23
+ module.exports = __toCommonJS(getTamaguiDefaultPath_exports);
24
+ var import_path = require("path");
25
+ var import_fs_extra = require("fs-extra");
26
+ let cachedPath = "";
27
+ async function getDefaultTamaguiConfigPath({
28
+ cwd = ".",
29
+ cache = true
30
+ }) {
31
+ if (cache && cachedPath) {
32
+ return cachedPath;
33
+ }
34
+ const defaultPaths = ["tamagui.config.ts", (0, import_path.join)("src", "tamagui.config.ts")].map(
35
+ (p) => (0, import_path.join)(cwd, p)
36
+ );
37
+ const existing = (await Promise.all(defaultPaths.map((path) => (0, import_fs_extra.pathExists)(path)))).findIndex(
38
+ (x) => !!x
39
+ );
40
+ const found = defaultPaths[existing];
41
+ if (!found) {
42
+ throw new Error(`No found tamagui.config.ts`);
43
+ }
44
+ cachedPath = found;
45
+ return found;
46
+ }
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ getDefaultTamaguiConfigPath
50
+ });
51
+ //# sourceMappingURL=getTamaguiDefaultPath.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/getTamaguiDefaultPath.ts"],
4
+ "sourcesContent": ["import { join } from 'path'\n\nimport { pathExists } from 'fs-extra'\n\nlet cachedPath = ''\n\nexport async function getDefaultTamaguiConfigPath({\n cwd = '.',\n cache = true,\n}: {\n cwd?: string\n // TODO this isn't passed down / could avoid\n cache?: boolean\n}) {\n if (cache && cachedPath) {\n return cachedPath\n }\n\n const defaultPaths = ['tamagui.config.ts', join('src', 'tamagui.config.ts')].map((p) =>\n join(cwd, p)\n )\n const existing = (await Promise.all(defaultPaths.map((path) => pathExists(path)))).findIndex(\n (x) => !!x\n )\n const found = defaultPaths[existing]\n if (!found) {\n throw new Error(`No found tamagui.config.ts`)\n }\n\n cachedPath = found\n return found\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AAErB,sBAA2B;AAE3B,IAAI,aAAa;AAEjB,eAAsB,4BAA4B;AAAA,EAChD,MAAM;AAAA,EACN,QAAQ;AACV,GAIG;AACD,MAAI,SAAS,YAAY;AACvB,WAAO;AAAA,EACT;AAEA,QAAM,eAAe,CAAC,yBAAqB,kBAAK,OAAO,mBAAmB,CAAC,EAAE;AAAA,IAAI,CAAC,UAChF,kBAAK,KAAK,CAAC;AAAA,EACb;AACA,QAAM,YAAY,MAAM,QAAQ,IAAI,aAAa,IAAI,CAAC,aAAS,4BAAW,IAAI,CAAC,CAAC,GAAG;AAAA,IACjF,CAAC,MAAM,CAAC,CAAC;AAAA,EACX;AACA,QAAM,QAAQ,aAAa;AAC3B,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAC9C;AAEA,eAAa;AACb,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var getTamaguiOptions_exports = {};
20
+ __export(getTamaguiOptions_exports, {
21
+ getTamaguiOptions: () => getTamaguiOptions
22
+ });
23
+ module.exports = __toCommonJS(getTamaguiOptions_exports);
24
+ var import_readTamaguiOptions = require("./readTamaguiOptions");
25
+ async function getTamaguiOptions({ cwd = "." }) {
26
+ return (await (0, import_readTamaguiOptions.readTamaguiOptions)({ cwd })).options;
27
+ }
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ getTamaguiOptions
31
+ });
32
+ //# sourceMappingURL=getTamaguiOptions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/getTamaguiOptions.ts"],
4
+ "sourcesContent": ["import { readTamaguiOptions } from './readTamaguiOptions'\n\nexport async function getTamaguiOptions({ cwd = '.' }: { cwd?: string }) {\n return (await readTamaguiOptions({ cwd })).options\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAmC;AAEnC,eAAsB,kBAAkB,EAAE,MAAM,IAAI,GAAqB;AACvE,UAAQ,UAAM,8CAAmB,EAAE,IAAI,CAAC,GAAG;AAC7C;",
6
+ "names": []
7
+ }
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./readTamaguiOptions"), module.exports);
19
+ __reExport(src_exports, require("./getTamaguiDefaultPath"), module.exports);
20
+ __reExport(src_exports, require("./getTamaguiOptions"), module.exports);
21
+ __reExport(src_exports, require("./types"), module.exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["export * from './readTamaguiOptions'\nexport * from './getTamaguiDefaultPath'\nexport * from './getTamaguiOptions'\nexport * from './types'\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,iCAAd;AACA,wBAAc,oCADd;AAEA,wBAAc,gCAFd;AAGA,wBAAc,oBAHd;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=readTamaguiJSON.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var readTamaguiOptions_exports = {};
20
+ __export(readTamaguiOptions_exports, {
21
+ readTamaguiOptions: () => readTamaguiOptions
22
+ });
23
+ module.exports = __toCommonJS(readTamaguiOptions_exports);
24
+ var import_path = require("path");
25
+ var import_fs_extra = require("fs-extra");
26
+ var import_getDefaultTamaguiOptions = require("./getDefaultTamaguiOptions");
27
+ async function readTamaguiOptions({ cwd = "." }) {
28
+ const filePath = (0, import_path.join)(cwd, "tamagui.json");
29
+ if (!await (0, import_fs_extra.pathExists)(filePath)) {
30
+ return {
31
+ exists: false,
32
+ options: await (0, import_getDefaultTamaguiOptions.getDefaultTamaguiOptions)({ cwd })
33
+ };
34
+ }
35
+ try {
36
+ const options = await (0, import_fs_extra.readJSON)(filePath);
37
+ if (!Array.isArray(options.components)) {
38
+ throw new Error(`Invalid components: not string[]`);
39
+ }
40
+ return {
41
+ exists: true,
42
+ options: {
43
+ ...!options.config && await (0, import_getDefaultTamaguiOptions.getDefaultTamaguiOptions)({ cwd }),
44
+ ...options
45
+ }
46
+ };
47
+ } catch (err) {
48
+ console.error(`Error reading tamagui.json: ${err.message} ${err.stack}`);
49
+ return {
50
+ exists: false,
51
+ options: await (0, import_getDefaultTamaguiOptions.getDefaultTamaguiOptions)({ cwd })
52
+ };
53
+ }
54
+ }
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ readTamaguiOptions
58
+ });
59
+ //# sourceMappingURL=readTamaguiOptions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/readTamaguiOptions.ts"],
4
+ "sourcesContent": ["import { join } from 'path'\n\nimport { pathExists, readJSON } from 'fs-extra'\n\nimport { getDefaultTamaguiOptions } from './getDefaultTamaguiOptions'\nimport type { TamaguiOptions } from './types'\n\nexport async function readTamaguiOptions({ cwd = '.' }: { cwd: string }) {\n const filePath = join(cwd, 'tamagui.json')\n\n if (!(await pathExists(filePath))) {\n return {\n exists: false,\n options: await getDefaultTamaguiOptions({ cwd }),\n }\n }\n\n try {\n const options = (await readJSON(filePath)) as TamaguiOptions\n\n if (!Array.isArray(options.components)) {\n throw new Error(`Invalid components: not string[]`)\n }\n\n return {\n exists: true,\n options: {\n ...(!options.config && (await getDefaultTamaguiOptions({ cwd }))),\n ...options,\n },\n }\n } catch (err: any) {\n // eslint-disable-next-line no-console\n console.error(`Error reading tamagui.json: ${err.message} ${err.stack}`)\n\n return {\n exists: false,\n options: await getDefaultTamaguiOptions({ cwd }),\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AAErB,sBAAqC;AAErC,sCAAyC;AAGzC,eAAsB,mBAAmB,EAAE,MAAM,IAAI,GAAoB;AACvE,QAAM,eAAW,kBAAK,KAAK,cAAc;AAEzC,MAAI,CAAE,UAAM,4BAAW,QAAQ,GAAI;AACjC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,SAAS,UAAM,0DAAyB,EAAE,IAAI,CAAC;AAAA,IACjD;AAAA,EACF;AAEA,MAAI;AACF,UAAM,UAAW,UAAM,0BAAS,QAAQ;AAExC,QAAI,CAAC,MAAM,QAAQ,QAAQ,UAAU,GAAG;AACtC,YAAM,IAAI,MAAM,kCAAkC;AAAA,IACpD;AAEA,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,GAAI,CAAC,QAAQ,UAAW,UAAM,0DAAyB,EAAE,IAAI,CAAC;AAAA,QAC9D,GAAG;AAAA,MACL;AAAA,IACF;AAAA,EACF,SAAS,KAAP;AAEA,YAAQ,MAAM,+BAA+B,IAAI,WAAW,IAAI,OAAO;AAEvE,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,SAAS,UAAM,0DAAyB,EAAE,IAAI,CAAC;AAAA,IACjD;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
package/dist/types.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
17
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/types.ts"],
4
+ "sourcesContent": ["export interface TamaguiOptions {\n // module paths you want to compile with tamagui (for example ['tamagui'])\n components: string[]\n // your tamagui.config.ts\n config?: string\n evaluateVars?: boolean\n importsWhitelist?: string[]\n disable?: boolean\n disableExtraction?: boolean\n disableDebugAttr?: boolean\n disableExtractInlineMedia?: boolean\n disableExtractVariables?: boolean\n excludeReactNativeWebExports?: string[]\n exclude?: RegExp\n logTimings?: boolean\n prefixLogs?: string\n\n // probably non user options\n cssPath?: string\n cssData?: any\n deoptProps?: Set<string>\n excludeProps?: Set<string>\n inlineProps?: Set<string>\n forceExtractStyleDefinitions?: boolean\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@tamagui/helpers-node",
3
+ "version": "1.0.1-beta.161",
4
+ "source": "src/index.ts",
5
+ "types": "./types/index.d.ts",
6
+ "main": "./dist",
7
+ "files": [
8
+ "src",
9
+ "types",
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "build": "tamagui-build",
14
+ "watch": "tamagui-build --watch",
15
+ "clean": "tamagui-build clean",
16
+ "clean:build": "tamagui-build clean:build"
17
+ },
18
+ "devDependencies": {
19
+ "@tamagui/build": "^1.0.1-beta.161",
20
+ "fs-extra": "^10.1.0"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ }
25
+ }
@@ -0,0 +1,13 @@
1
+ import { getDefaultTamaguiConfigPath } from './getTamaguiDefaultPath'
2
+ import type { TamaguiOptions } from './types'
3
+
4
+ export async function getDefaultTamaguiOptions({
5
+ cwd = '.',
6
+ }: {
7
+ cwd: string
8
+ }): Promise<TamaguiOptions> {
9
+ return {
10
+ components: ['tamagui'],
11
+ config: await getDefaultTamaguiConfigPath({ cwd }),
12
+ }
13
+ }
@@ -0,0 +1,32 @@
1
+ import { join } from 'path'
2
+
3
+ import { pathExists } from 'fs-extra'
4
+
5
+ let cachedPath = ''
6
+
7
+ export async function getDefaultTamaguiConfigPath({
8
+ cwd = '.',
9
+ cache = true,
10
+ }: {
11
+ cwd?: string
12
+ // TODO this isn't passed down / could avoid
13
+ cache?: boolean
14
+ }) {
15
+ if (cache && cachedPath) {
16
+ return cachedPath
17
+ }
18
+
19
+ const defaultPaths = ['tamagui.config.ts', join('src', 'tamagui.config.ts')].map((p) =>
20
+ join(cwd, p)
21
+ )
22
+ const existing = (await Promise.all(defaultPaths.map((path) => pathExists(path)))).findIndex(
23
+ (x) => !!x
24
+ )
25
+ const found = defaultPaths[existing]
26
+ if (!found) {
27
+ throw new Error(`No found tamagui.config.ts`)
28
+ }
29
+
30
+ cachedPath = found
31
+ return found
32
+ }
@@ -0,0 +1,5 @@
1
+ import { readTamaguiOptions } from './readTamaguiOptions'
2
+
3
+ export async function getTamaguiOptions({ cwd = '.' }: { cwd?: string }) {
4
+ return (await readTamaguiOptions({ cwd })).options
5
+ }
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './readTamaguiOptions'
2
+ export * from './getTamaguiDefaultPath'
3
+ export * from './getTamaguiOptions'
4
+ export * from './types'
@@ -0,0 +1,41 @@
1
+ import { join } from 'path'
2
+
3
+ import { pathExists, readJSON } from 'fs-extra'
4
+
5
+ import { getDefaultTamaguiOptions } from './getDefaultTamaguiOptions'
6
+ import type { TamaguiOptions } from './types'
7
+
8
+ export async function readTamaguiOptions({ cwd = '.' }: { cwd: string }) {
9
+ const filePath = join(cwd, 'tamagui.json')
10
+
11
+ if (!(await pathExists(filePath))) {
12
+ return {
13
+ exists: false,
14
+ options: await getDefaultTamaguiOptions({ cwd }),
15
+ }
16
+ }
17
+
18
+ try {
19
+ const options = (await readJSON(filePath)) as TamaguiOptions
20
+
21
+ if (!Array.isArray(options.components)) {
22
+ throw new Error(`Invalid components: not string[]`)
23
+ }
24
+
25
+ return {
26
+ exists: true,
27
+ options: {
28
+ ...(!options.config && (await getDefaultTamaguiOptions({ cwd }))),
29
+ ...options,
30
+ },
31
+ }
32
+ } catch (err: any) {
33
+ // eslint-disable-next-line no-console
34
+ console.error(`Error reading tamagui.json: ${err.message} ${err.stack}`)
35
+
36
+ return {
37
+ exists: false,
38
+ options: await getDefaultTamaguiOptions({ cwd }),
39
+ }
40
+ }
41
+ }
package/src/types.ts ADDED
@@ -0,0 +1,25 @@
1
+ export interface TamaguiOptions {
2
+ // module paths you want to compile with tamagui (for example ['tamagui'])
3
+ components: string[]
4
+ // your tamagui.config.ts
5
+ config?: string
6
+ evaluateVars?: boolean
7
+ importsWhitelist?: string[]
8
+ disable?: boolean
9
+ disableExtraction?: boolean
10
+ disableDebugAttr?: boolean
11
+ disableExtractInlineMedia?: boolean
12
+ disableExtractVariables?: boolean
13
+ excludeReactNativeWebExports?: string[]
14
+ exclude?: RegExp
15
+ logTimings?: boolean
16
+ prefixLogs?: string
17
+
18
+ // probably non user options
19
+ cssPath?: string
20
+ cssData?: any
21
+ deoptProps?: Set<string>
22
+ excludeProps?: Set<string>
23
+ inlineProps?: Set<string>
24
+ forceExtractStyleDefinitions?: boolean
25
+ }
@@ -0,0 +1,10 @@
1
+ export declare function getDefaultTamaguiConfig({ cwd }: {
2
+ cwd: string;
3
+ }): Promise<{
4
+ exists: boolean;
5
+ config: {
6
+ components: string[];
7
+ config: string;
8
+ };
9
+ }>;
10
+ //# sourceMappingURL=getDefaultTamaguiConfig.d.ts.map
@@ -0,0 +1,5 @@
1
+ import type { TamaguiOptions } from './types';
2
+ export declare function getDefaultTamaguiOptions({ cwd, }: {
3
+ cwd: string;
4
+ }): Promise<TamaguiOptions>;
5
+ //# sourceMappingURL=getDefaultTamaguiOptions.d.ts.map
@@ -0,0 +1,5 @@
1
+ export declare function getDefaultTamaguiConfigPath({ cwd, cache, }: {
2
+ cwd?: string;
3
+ cache?: boolean;
4
+ }): Promise<string>;
5
+ //# sourceMappingURL=getTamaguiDefaultPath.d.ts.map
@@ -0,0 +1,4 @@
1
+ export declare function getTamaguiOptions({ cwd }: {
2
+ cwd?: string;
3
+ }): Promise<import("./types").TamaguiOptions>;
4
+ //# sourceMappingURL=getTamaguiOptions.d.ts.map
@@ -0,0 +1,5 @@
1
+ export * from './readTamaguiOptions';
2
+ export * from './getTamaguiDefaultPath';
3
+ export * from './getTamaguiOptions';
4
+ export * from './types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=readTamaguiJSON.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { TamaguiOptions } from './types';
2
+ export declare function readTamaguiOptions({ cwd }: {
3
+ cwd: string;
4
+ }): Promise<{
5
+ exists: boolean;
6
+ options: TamaguiOptions;
7
+ }>;
8
+ //# sourceMappingURL=readTamaguiOptions.d.ts.map
@@ -0,0 +1,22 @@
1
+ export interface TamaguiOptions {
2
+ components: string[];
3
+ config?: string;
4
+ evaluateVars?: boolean;
5
+ importsWhitelist?: string[];
6
+ disable?: boolean;
7
+ disableExtraction?: boolean;
8
+ disableDebugAttr?: boolean;
9
+ disableExtractInlineMedia?: boolean;
10
+ disableExtractVariables?: boolean;
11
+ excludeReactNativeWebExports?: string[];
12
+ exclude?: RegExp;
13
+ logTimings?: boolean;
14
+ prefixLogs?: string;
15
+ cssPath?: string;
16
+ cssData?: any;
17
+ deoptProps?: Set<string>;
18
+ excludeProps?: Set<string>;
19
+ inlineProps?: Set<string>;
20
+ forceExtractStyleDefinitions?: boolean;
21
+ }
22
+ //# sourceMappingURL=types.d.ts.map