@multiplatform.one/config 6.0.0
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/LICENSE +201 -0
- package/README.md +57 -0
- package/lib/index.js +5 -0
- package/lib/playwright.js +107 -0
- package/lib/storybook.js +204 -0
- package/lib/vite-BfDEN9iw.js +369 -0
- package/lib/vite.js +4 -0
- package/lib/vitest.js +150 -0
- package/lib/workspacePublicPackages-BPzu1MKc.js +56 -0
- package/package.json +110 -0
- package/src/index.ts +3 -0
- package/src/playwright.ts +239 -0
- package/src/reactNative.config.cjs +5 -0
- package/src/storybook.ts +318 -0
- package/src/vite.ts +623 -0
- package/src/vitest.ts +255 -0
- package/src/workspacePublicPackages.spec.ts +72 -0
- package/src/workspacePublicPackages.ts +59 -0
- package/tsconfig/app.json +22 -0
- package/tsconfig/base.json +39 -0
- package/tsconfig/build.json +24 -0
- package/tsconfig/tamagui_fix.d.ts +29 -0
package/src/vitest.ts
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { tamaguiPlugin } from "@tamagui/vite-plugin";
|
|
3
|
+
import react from "@vitejs/plugin-react";
|
|
4
|
+
import type { UserConfig } from "vite";
|
|
5
|
+
|
|
6
|
+
export interface CreateVitestConfigOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Path to the Tamagui config file for test environments.
|
|
9
|
+
* Defaults to "./tests/tamagui.config.ts".
|
|
10
|
+
* Set to false to disable the Tamagui plugin.
|
|
11
|
+
*/
|
|
12
|
+
tamaguiConfig?: string | false;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Test environment. Defaults to "jsdom".
|
|
16
|
+
*/
|
|
17
|
+
environment?: "jsdom" | "happy-dom" | "node";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Setup files to run before tests.
|
|
21
|
+
*/
|
|
22
|
+
setupFiles?: string[];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Test timeout in ms. Defaults to 30000.
|
|
26
|
+
*/
|
|
27
|
+
testTimeout?: number;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Additional deps to inline in test server.
|
|
31
|
+
*/
|
|
32
|
+
inlineDeps?: string[];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Dependencies to externalize in test server (server.deps.external).
|
|
36
|
+
*/
|
|
37
|
+
externalDeps?: string[];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Additional resolve aliases.
|
|
41
|
+
*/
|
|
42
|
+
aliases?: Record<string, string>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Coverage configuration overrides.
|
|
46
|
+
*/
|
|
47
|
+
coverage?: {
|
|
48
|
+
exclude?: string[];
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Whether to replace react-native imports with react-native-web.
|
|
53
|
+
* Defaults to true.
|
|
54
|
+
*/
|
|
55
|
+
replaceReactNative?: boolean;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Whether to deduplicate React to root node_modules.
|
|
59
|
+
* Defaults to true. Prevents "multiple React instances" errors in monorepo.
|
|
60
|
+
*/
|
|
61
|
+
dedupeReact?: boolean;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Absolute path to root node_modules for React deduplication.
|
|
65
|
+
* Defaults to ../../node_modules relative to cwd.
|
|
66
|
+
*/
|
|
67
|
+
rootNodeModules?: string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Additional resolve conditions. Defaults to ["source", "test", "browser"].
|
|
71
|
+
*/
|
|
72
|
+
conditions?: string[];
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Test include patterns. Defaults to vitest default.
|
|
76
|
+
*/
|
|
77
|
+
include?: string[];
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Test exclude patterns. Defaults to vitest default.
|
|
81
|
+
*/
|
|
82
|
+
exclude?: string[];
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Whether to pass when no tests are found. Defaults to false.
|
|
86
|
+
*/
|
|
87
|
+
passWithNoTests?: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Creates a shared Vitest configuration for multiplatform.one packages.
|
|
92
|
+
*
|
|
93
|
+
* This eliminates the ~100 lines of duplicated vitest config across 13+ packages,
|
|
94
|
+
* handling Tamagui transforms, react-native-web replacement, React deduplication,
|
|
95
|
+
* and consistent coverage/environment settings.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* // packages/components/vitest.config.mjs
|
|
100
|
+
* import { createVitestConfig } from "@multiplatform.one/config/vitest";
|
|
101
|
+
*
|
|
102
|
+
* export default createVitestConfig({
|
|
103
|
+
* setupFiles: ["./tests/setup.tsx"],
|
|
104
|
+
* tamaguiConfig: "../../features/tamagui.config.ts",
|
|
105
|
+
* });
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export function createVitestConfig(options: CreateVitestConfigOptions = {}): UserConfig {
|
|
109
|
+
const {
|
|
110
|
+
tamaguiConfig = "./tests/tamagui.config.ts",
|
|
111
|
+
environment = "jsdom",
|
|
112
|
+
setupFiles = [],
|
|
113
|
+
testTimeout = 30000,
|
|
114
|
+
inlineDeps = [],
|
|
115
|
+
externalDeps = [],
|
|
116
|
+
aliases = {},
|
|
117
|
+
coverage,
|
|
118
|
+
replaceReactNative = true,
|
|
119
|
+
dedupeReact = true,
|
|
120
|
+
rootNodeModules: _rootNodeModules,
|
|
121
|
+
conditions = ["source", "test", "browser"],
|
|
122
|
+
include,
|
|
123
|
+
exclude,
|
|
124
|
+
passWithNoTests,
|
|
125
|
+
} = options;
|
|
126
|
+
|
|
127
|
+
const rootNodeModules = _rootNodeModules || path.resolve(process.cwd(), "../../node_modules");
|
|
128
|
+
|
|
129
|
+
const plugins: any[] = [
|
|
130
|
+
react({
|
|
131
|
+
jsxRuntime: "automatic",
|
|
132
|
+
}),
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
// Replace react-native imports with react-native-web
|
|
136
|
+
if (replaceReactNative) {
|
|
137
|
+
plugins.push({
|
|
138
|
+
name: "replace-react-native",
|
|
139
|
+
transform(code: string, id: string) {
|
|
140
|
+
if (id.includes("node_modules")) return;
|
|
141
|
+
return {
|
|
142
|
+
code: code.replace(/from ['"]react-native['"]/g, 'from "react-native-web"'),
|
|
143
|
+
map: null,
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Tamagui plugin for test environment
|
|
150
|
+
if (tamaguiConfig !== false) {
|
|
151
|
+
plugins.push(
|
|
152
|
+
tamaguiPlugin({
|
|
153
|
+
components: ["tamagui"],
|
|
154
|
+
config: tamaguiConfig,
|
|
155
|
+
} as any),
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Build resolve aliases
|
|
160
|
+
const resolveAliases: Record<string, string> = {};
|
|
161
|
+
if (replaceReactNative) {
|
|
162
|
+
resolveAliases["react-native"] = "react-native-web";
|
|
163
|
+
// Replace react-native-svg with tamagui's web-safe SVG shim.
|
|
164
|
+
// react-native-svg's CJS build calls require("react-native"), and in Node.js 24
|
|
165
|
+
// that triggers importSyncForRequire which tries to parse react-native/index.js
|
|
166
|
+
// as ESM. That file contains Flow syntax (`import typeof`) which is invalid ESM,
|
|
167
|
+
// so Node.js 24 throws SyntaxError: Unexpected token 'typeof'.
|
|
168
|
+
resolveAliases["react-native-svg"] = "@tamagui/react-native-svg";
|
|
169
|
+
}
|
|
170
|
+
if (dedupeReact) {
|
|
171
|
+
resolveAliases.react = path.resolve(rootNodeModules, "react");
|
|
172
|
+
resolveAliases["react-dom"] = path.resolve(rootNodeModules, "react-dom");
|
|
173
|
+
resolveAliases["react-dom/client"] = path.resolve(rootNodeModules, "react-dom/client");
|
|
174
|
+
resolveAliases["react-dom/server"] = path.resolve(rootNodeModules, "react-dom/server");
|
|
175
|
+
resolveAliases["react/jsx-runtime"] = path.resolve(rootNodeModules, "react/jsx-runtime");
|
|
176
|
+
resolveAliases["react/jsx-dev-runtime"] = path.resolve(
|
|
177
|
+
rootNodeModules,
|
|
178
|
+
"react/jsx-dev-runtime",
|
|
179
|
+
);
|
|
180
|
+
resolveAliases.scheduler = path.resolve(rootNodeModules, "scheduler");
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const testConfig: Record<string, unknown> = {
|
|
184
|
+
environment,
|
|
185
|
+
globals: true,
|
|
186
|
+
setupFiles,
|
|
187
|
+
testTimeout,
|
|
188
|
+
coverage: {
|
|
189
|
+
provider: "v8" as const,
|
|
190
|
+
reporter: ["text", "lcov", "html"],
|
|
191
|
+
reportsDirectory: "./coverage",
|
|
192
|
+
all: true,
|
|
193
|
+
clean: true,
|
|
194
|
+
exclude: [
|
|
195
|
+
"node_modules/",
|
|
196
|
+
"tests/",
|
|
197
|
+
"*.config.*",
|
|
198
|
+
"**/*.stories.*",
|
|
199
|
+
"**/*.spec.*",
|
|
200
|
+
"**/*.test.*",
|
|
201
|
+
...(coverage?.exclude || []),
|
|
202
|
+
],
|
|
203
|
+
},
|
|
204
|
+
server: {
|
|
205
|
+
deps: {
|
|
206
|
+
inline: ["react-native-web", "one", /@tamagui\//, "tamagui", ...inlineDeps],
|
|
207
|
+
...(externalDeps.length > 0 ? { external: externalDeps } : {}),
|
|
208
|
+
interopDefault: true,
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
if (include) testConfig.include = include;
|
|
213
|
+
if (exclude) testConfig.exclude = exclude;
|
|
214
|
+
if (passWithNoTests) testConfig.passWithNoTests = true;
|
|
215
|
+
|
|
216
|
+
return {
|
|
217
|
+
plugins,
|
|
218
|
+
test: testConfig,
|
|
219
|
+
resolve: {
|
|
220
|
+
extensions: [
|
|
221
|
+
".test.ts",
|
|
222
|
+
".test.tsx",
|
|
223
|
+
".web.ts",
|
|
224
|
+
".web.tsx",
|
|
225
|
+
".web.js",
|
|
226
|
+
".web.jsx",
|
|
227
|
+
".ts",
|
|
228
|
+
".tsx",
|
|
229
|
+
".js",
|
|
230
|
+
".jsx",
|
|
231
|
+
],
|
|
232
|
+
mainFields: ["browser", "module", "main"],
|
|
233
|
+
alias: {
|
|
234
|
+
...resolveAliases,
|
|
235
|
+
...aliases,
|
|
236
|
+
},
|
|
237
|
+
conditions,
|
|
238
|
+
dedupe: dedupeReact ? ["react", "react-dom", "scheduler"] : [],
|
|
239
|
+
},
|
|
240
|
+
define: {
|
|
241
|
+
__DEV__: true,
|
|
242
|
+
global: "globalThis",
|
|
243
|
+
process: JSON.stringify({
|
|
244
|
+
env: {
|
|
245
|
+
NODE_ENV: "test",
|
|
246
|
+
NODE_DEBUG: false,
|
|
247
|
+
},
|
|
248
|
+
platform: process.platform,
|
|
249
|
+
version: process.version,
|
|
250
|
+
type: "renderer",
|
|
251
|
+
}),
|
|
252
|
+
"Buffer.isBuffer": "((obj) => obj?.constructor?.name === 'Buffer')",
|
|
253
|
+
},
|
|
254
|
+
} as UserConfig;
|
|
255
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import {
|
|
4
|
+
discoverPublicPackageRoots,
|
|
5
|
+
resolvePackageMainSource,
|
|
6
|
+
publicPackageViteSourceAliases,
|
|
7
|
+
} from "./workspacePublicPackages";
|
|
8
|
+
|
|
9
|
+
const workspaceRoot = path.resolve(__dirname, "../../..");
|
|
10
|
+
|
|
11
|
+
describe("discoverPublicPackageRoots", () => {
|
|
12
|
+
it("returns a Map of package names to their directories", () => {
|
|
13
|
+
const roots = discoverPublicPackageRoots(workspaceRoot);
|
|
14
|
+
expect(roots).toBeInstanceOf(Map);
|
|
15
|
+
expect(roots.size).toBeGreaterThan(0);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("includes known packages", () => {
|
|
19
|
+
const roots = discoverPublicPackageRoots(workspaceRoot);
|
|
20
|
+
expect(roots.has("@multiplatform.one/platform")).toBe(true);
|
|
21
|
+
expect(roots.has("@multiplatform.one/theme")).toBe(true);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("maps package names to paths within public/", () => {
|
|
25
|
+
const roots = discoverPublicPackageRoots(workspaceRoot);
|
|
26
|
+
const platformPath = roots.get("@multiplatform.one/platform");
|
|
27
|
+
expect(platformPath).toBeDefined();
|
|
28
|
+
expect(platformPath).toContain(path.join("public", "platform"));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("returns empty Map for non-existent directory", () => {
|
|
32
|
+
const roots = discoverPublicPackageRoots("/nonexistent/path");
|
|
33
|
+
expect(roots.size).toBe(0);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe("resolvePackageMainSource", () => {
|
|
38
|
+
it("resolves the main source file for a known package", () => {
|
|
39
|
+
const roots = discoverPublicPackageRoots(workspaceRoot);
|
|
40
|
+
const platformDir = roots.get("@multiplatform.one/platform");
|
|
41
|
+
expect(platformDir).toBeDefined();
|
|
42
|
+
|
|
43
|
+
const main = resolvePackageMainSource(platformDir!);
|
|
44
|
+
expect(main).toBeDefined();
|
|
45
|
+
expect(main).toMatch(/index\.(ts|tsx)$/);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("returns undefined for a directory with no index file", () => {
|
|
49
|
+
const main = resolvePackageMainSource("/nonexistent/pkg");
|
|
50
|
+
expect(main).toBeUndefined();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe("publicPackageViteSourceAliases", () => {
|
|
55
|
+
it("returns an object mapping package names to source files", () => {
|
|
56
|
+
const aliases = publicPackageViteSourceAliases(workspaceRoot);
|
|
57
|
+
expect(typeof aliases).toBe("object");
|
|
58
|
+
expect(Object.keys(aliases).length).toBeGreaterThan(0);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("each alias value points to a .ts or .tsx file", () => {
|
|
62
|
+
const aliases = publicPackageViteSourceAliases(workspaceRoot);
|
|
63
|
+
for (const [, filePath] of Object.entries(aliases)) {
|
|
64
|
+
expect(filePath).toMatch(/\.(ts|tsx)$/);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("includes known package aliases", () => {
|
|
69
|
+
const aliases = publicPackageViteSourceAliases(workspaceRoot);
|
|
70
|
+
expect(aliases["@multiplatform.one/platform"]).toBeDefined();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Every direct child of `public/` with a `package.json` `name` is treated as a
|
|
6
|
+
* publishable workspace package (same rule as Metro in `apps/storybook-expo`).
|
|
7
|
+
*
|
|
8
|
+
* Tamagui’s internal esbuild (bundling `tamagui.config` + `components`) reads
|
|
9
|
+
* `compilerOptions.paths` from the repo `tsconfig.base.json` chain, including
|
|
10
|
+
* `tamagui-workspace-paths.generated.json` (see `scripts/generate-tamagui-workspace-paths.mjs`).
|
|
11
|
+
*/
|
|
12
|
+
export function discoverPublicPackageRoots(workspaceRoot: string): Map<string, string> {
|
|
13
|
+
const byName = new Map<string, string>();
|
|
14
|
+
const publicDir = path.join(workspaceRoot, "public");
|
|
15
|
+
if (!fs.existsSync(publicDir)) return byName;
|
|
16
|
+
for (const ent of fs.readdirSync(publicDir, { withFileTypes: true })) {
|
|
17
|
+
if (!ent.isDirectory()) continue;
|
|
18
|
+
const pkgRoot = path.join(publicDir, ent.name);
|
|
19
|
+
const pkgJsonPath = path.join(pkgRoot, "package.json");
|
|
20
|
+
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
21
|
+
try {
|
|
22
|
+
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8")) as { name?: string };
|
|
23
|
+
if (typeof pkg.name === "string" && pkg.name.length > 0) {
|
|
24
|
+
byName.set(pkg.name, pkgRoot);
|
|
25
|
+
}
|
|
26
|
+
} catch {
|
|
27
|
+
/* invalid package.json */
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return byName;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Main entry file for Vite/Storybook-style “compile from source” aliases. */
|
|
34
|
+
export function resolvePackageMainSource(pkgDir: string): string | undefined {
|
|
35
|
+
const candidates = [
|
|
36
|
+
path.join(pkgDir, "src", "index.storybook.ts"),
|
|
37
|
+
path.join(pkgDir, "src", "index.storybook.tsx"),
|
|
38
|
+
path.join(pkgDir, "src", "index.ts"),
|
|
39
|
+
path.join(pkgDir, "src", "index.tsx"),
|
|
40
|
+
path.join(pkgDir, "index.storybook.ts"),
|
|
41
|
+
path.join(pkgDir, "index.storybook.tsx"),
|
|
42
|
+
path.join(pkgDir, "index.ts"),
|
|
43
|
+
path.join(pkgDir, "index.tsx"),
|
|
44
|
+
];
|
|
45
|
+
return candidates.find((c) => fs.existsSync(c));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Vite `resolve.alias` entries: each public package name → its TypeScript main.
|
|
50
|
+
* For SPA / ad-hoc Vite configs that should not list packages by hand.
|
|
51
|
+
*/
|
|
52
|
+
export function publicPackageViteSourceAliases(workspaceRoot: string): Record<string, string> {
|
|
53
|
+
const aliases: Record<string, string> = {};
|
|
54
|
+
for (const [name, dir] of discoverPublicPackageRoots(workspaceRoot)) {
|
|
55
|
+
const main = resolvePackageMainSource(dir);
|
|
56
|
+
if (main) aliases[name] = main;
|
|
57
|
+
}
|
|
58
|
+
return aliases;
|
|
59
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "App configuration for multiplatform.one apps",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"composite": false,
|
|
6
|
+
"declaration": false,
|
|
7
|
+
"declarationMap": false,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"jsx": "react-jsx",
|
|
11
|
+
"module": "ESNext",
|
|
12
|
+
"moduleResolution": "Bundler",
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"strict": true,
|
|
15
|
+
"esModuleInterop": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"forceConsistentCasingInFileNames": true,
|
|
18
|
+
"target": "ES2020",
|
|
19
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
20
|
+
"types": ["node", "react", "vite/client"]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"rootDir": ".",
|
|
6
|
+
"composite": true,
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"declarationMap": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"importHelpers": true,
|
|
11
|
+
"allowJs": false,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"allowSyntheticDefaultImports": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"downlevelIteration": true,
|
|
16
|
+
"strict": true,
|
|
17
|
+
"esModuleInterop": true,
|
|
18
|
+
"preserveSymlinks": true,
|
|
19
|
+
"jsx": "react-jsx",
|
|
20
|
+
"module": "ESNext",
|
|
21
|
+
"moduleResolution": "Bundler",
|
|
22
|
+
"noEmit": false,
|
|
23
|
+
"noEmitOnError": true,
|
|
24
|
+
"noImplicitAny": false,
|
|
25
|
+
"noImplicitReturns": false,
|
|
26
|
+
"noUnusedLocals": false,
|
|
27
|
+
"noUnusedParameters": false,
|
|
28
|
+
"preserveConstEnums": true,
|
|
29
|
+
"removeComments": false,
|
|
30
|
+
"skipLibCheck": true,
|
|
31
|
+
"strictNullChecks": true,
|
|
32
|
+
"target": "ES2020",
|
|
33
|
+
"types": ["node", "react", "vite/client", "@testing-library/jest-dom/vitest"],
|
|
34
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"]
|
|
35
|
+
},
|
|
36
|
+
"typeAcquisition": {
|
|
37
|
+
"enable": true
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "Build configuration for multiplatform.one packages",
|
|
4
|
+
"extends": "./base.json",
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"declarationDir": "./types",
|
|
8
|
+
"tsBuildInfoFile": "./dist/.tsbuildinfo"
|
|
9
|
+
},
|
|
10
|
+
"include": ["**/*"],
|
|
11
|
+
"exclude": [
|
|
12
|
+
"tests",
|
|
13
|
+
"types",
|
|
14
|
+
"dist",
|
|
15
|
+
"**/*.spec.ts",
|
|
16
|
+
"**/*.spec.tsx",
|
|
17
|
+
"**/*.test.ts",
|
|
18
|
+
"**/*.test.tsx",
|
|
19
|
+
"**/*.stories.ts",
|
|
20
|
+
"**/*.stories.tsx",
|
|
21
|
+
"vitest.config.ts",
|
|
22
|
+
"vitest.config.mjs"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type augmentation for Tamagui v2 RC children type issue.
|
|
3
|
+
*
|
|
4
|
+
* Tamagui v2 RC 11 component types resolve to a structure where `children`
|
|
5
|
+
* is omitted from the JSX element props, causing thousands of type errors like:
|
|
6
|
+
* Type '{ children: Element[]; }' is not assignable to type 'WithShorthands<...>'
|
|
7
|
+
*
|
|
8
|
+
* This augmentation fixes the issue by extending the base prop types to accept
|
|
9
|
+
* children. Remove once Tamagui v2 stable resolves this.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { ReactNode } from "react";
|
|
13
|
+
|
|
14
|
+
declare module "@tamagui/web" {
|
|
15
|
+
interface TamaguiComponentPropsBaseBase {
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare module "@tamagui/core" {
|
|
21
|
+
interface TamaguiComponentPropsBaseBase {
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Re-export from tamagui/web which is an internal entry point without type declarations
|
|
27
|
+
declare module "tamagui/web" {
|
|
28
|
+
export * from "@tamagui/web";
|
|
29
|
+
}
|