@multiplatform.one/config 6.1.0 → 6.3.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/lib/index.js +1 -1
- package/lib/storybook.js +3 -1
- package/lib/{vite-BfDEN9iw.js → vite-C6psj1Lz.js} +35 -1
- package/lib/vite.js +2 -2
- package/lib/{workspacePublicPackages-BPzu1MKc.js → workspacePublicPackages-CkDbm3QT.js} +12 -1
- package/package.json +16 -11
- package/src/react-native.config.cjs +14 -0
- package/src/storybook.spec.ts +22 -0
- package/src/storybook.ts +6 -0
- package/src/vite.ts +52 -0
- package/src/workspacePublicPackages.ts +12 -1
- package/tsconfig/build.json +42 -15
- package/types/index.d.ts +4 -0
- package/types/index.d.ts.map +1 -0
- package/types/playwright.d.ts +116 -0
- package/types/playwright.d.ts.map +1 -0
- package/types/storybook.d.ts +41 -0
- package/types/storybook.d.ts.map +1 -0
- package/types/vite.d.ts +122 -0
- package/types/vite.d.ts.map +1 -0
- package/types/vitest.d.ts +90 -0
- package/types/vitest.d.ts.map +1 -0
- package/types/workspacePublicPackages.d.ts +24 -0
- package/types/workspacePublicPackages.d.ts.map +1 -0
- package/src/reactNative.config.cjs +0 -5
package/lib/index.js
CHANGED
package/lib/storybook.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as resolvePackageMainSource, t as discoverPublicPackageRoots } from "./workspacePublicPackages-
|
|
1
|
+
import { r as resolvePackageMainSource, t as discoverPublicPackageRoots } from "./workspacePublicPackages-CkDbm3QT.js";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
@@ -67,6 +67,8 @@ function createStorybookViteConfig(options = {}) {
|
|
|
67
67
|
"@mdx-js/react",
|
|
68
68
|
"i18next",
|
|
69
69
|
"react-i18next",
|
|
70
|
+
"d3-shape",
|
|
71
|
+
"d3-scale",
|
|
70
72
|
"@storybook-community/storybook-dark-mode",
|
|
71
73
|
"use-latest-callback",
|
|
72
74
|
"escape-string-regexp",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as discoverPublicPackageRoots } from "./workspacePublicPackages-
|
|
1
|
+
import { t as discoverPublicPackageRoots } from "./workspacePublicPackages-CkDbm3QT.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
@@ -88,6 +88,7 @@ function createViteConfig(options = {}) {
|
|
|
88
88
|
vitePlugins.push(clientBrokenEsmPlugin());
|
|
89
89
|
registerNativeEngineIoBrowserTransports();
|
|
90
90
|
registerNativeWorkspaceEntries();
|
|
91
|
+
registerNativePhosphorIcons();
|
|
91
92
|
}
|
|
92
93
|
if (tamagui) {
|
|
93
94
|
const tamaguiOpts = typeof tamagui === "object" ? tamagui : {};
|
|
@@ -332,6 +333,39 @@ function findProjectRoot() {
|
|
|
332
333
|
}
|
|
333
334
|
}
|
|
334
335
|
/**
|
|
336
|
+
* Resolve `@phosphor-icons/react` to `phosphor-react-native` in the NATIVE
|
|
337
|
+
* graph only. The web package renders DOM `<svg>`/`<path>` and crashes Hermes
|
|
338
|
+
* the moment any icon mounts; the RN package draws the same icon set through
|
|
339
|
+
* react-native-svg and (as of v3) exports identical `*Icon`-suffixed names,
|
|
340
|
+
* so app/library source needs no platform splits. Skipped (with a warning)
|
|
341
|
+
* when phosphor-react-native isn't installed in the consuming project.
|
|
342
|
+
*/
|
|
343
|
+
function registerNativePhosphorIcons() {
|
|
344
|
+
const g = globalThis;
|
|
345
|
+
const name = "vxrn-phosphor-native-icons";
|
|
346
|
+
g.__vxrnAddNativePlugins = g.__vxrnAddNativePlugins ?? [];
|
|
347
|
+
if (g.__vxrnAddNativePlugins.some((p) => p?.name === name)) return;
|
|
348
|
+
let nativeEntry = null;
|
|
349
|
+
try {
|
|
350
|
+
const cjsEntry = __require.resolve("phosphor-react-native", { paths: [findProjectRoot(), process.cwd()] });
|
|
351
|
+
const esmEntry = cjsEntry.replace(`${path.sep}lib${path.sep}commonjs${path.sep}`, `${path.sep}lib${path.sep}module${path.sep}`);
|
|
352
|
+
nativeEntry = fs.existsSync(esmEntry) ? esmEntry : cjsEntry;
|
|
353
|
+
} catch {
|
|
354
|
+
nativeEntry = null;
|
|
355
|
+
}
|
|
356
|
+
g.__vxrnAddNativePlugins.push({
|
|
357
|
+
name,
|
|
358
|
+
resolveId(id) {
|
|
359
|
+
if (id !== "@phosphor-icons/react") return null;
|
|
360
|
+
if (!nativeEntry) {
|
|
361
|
+
console.warn("[config] @phosphor-icons/react imported in the native graph but phosphor-react-native is not installed — icons will crash Hermes. Add phosphor-react-native to your app dependencies.");
|
|
362
|
+
return null;
|
|
363
|
+
}
|
|
364
|
+
return nativeEntry;
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
335
369
|
* package.json `exports` cannot branch on whether `dist/` exists. For workspace
|
|
336
370
|
* packages, prefer `dist/esm/index.{mjs,js}` when built; otherwise fall back to
|
|
337
371
|
* `src/index.ts` so local dev works without a build while published tarballs
|
package/lib/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createViteConfig } from "./vite-
|
|
2
|
-
import { n as publicPackageViteSourceAliases, t as discoverPublicPackageRoots } from "./workspacePublicPackages-
|
|
1
|
+
import { t as createViteConfig } from "./vite-C6psj1Lz.js";
|
|
2
|
+
import { n as publicPackageViteSourceAliases, t as discoverPublicPackageRoots } from "./workspacePublicPackages-CkDbm3QT.js";
|
|
3
3
|
|
|
4
4
|
export { createViteConfig, discoverPublicPackageRoots, publicPackageViteSourceAliases };
|
|
@@ -26,15 +26,26 @@ function discoverPublicPackageRoots(workspaceRoot) {
|
|
|
26
26
|
}
|
|
27
27
|
return byName;
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Main entry file for Vite/Storybook-style “compile from source” aliases.
|
|
31
|
+
*
|
|
32
|
+
* These aliases are only consumed by WEB Vite configs (Storybook, SPA), so
|
|
33
|
+
* `.web.*` entries take priority over the plain (native) ones — otherwise a
|
|
34
|
+
* package like @package/fonts resolves to its native index.ts and its
|
|
35
|
+
* web-only side effects (fontsource @font-face CSS imports) never load.
|
|
36
|
+
*/
|
|
30
37
|
function resolvePackageMainSource(pkgDir) {
|
|
31
38
|
return [
|
|
32
39
|
path.join(pkgDir, "src", "index.storybook.ts"),
|
|
33
40
|
path.join(pkgDir, "src", "index.storybook.tsx"),
|
|
41
|
+
path.join(pkgDir, "src", "index.web.ts"),
|
|
42
|
+
path.join(pkgDir, "src", "index.web.tsx"),
|
|
34
43
|
path.join(pkgDir, "src", "index.ts"),
|
|
35
44
|
path.join(pkgDir, "src", "index.tsx"),
|
|
36
45
|
path.join(pkgDir, "index.storybook.ts"),
|
|
37
46
|
path.join(pkgDir, "index.storybook.tsx"),
|
|
47
|
+
path.join(pkgDir, "index.web.ts"),
|
|
48
|
+
path.join(pkgDir, "index.web.tsx"),
|
|
38
49
|
path.join(pkgDir, "index.ts"),
|
|
39
50
|
path.join(pkgDir, "index.tsx")
|
|
40
51
|
].find((c) => fs.existsSync(c));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/config",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "Shared build and test configuration presets for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -20,49 +20,54 @@
|
|
|
20
20
|
"author": "BitSpur <support@risserlabs.com> (https://risserlabs.com)",
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
|
-
"url": "https://gitlab.com/bitspur/multiplatform.one
|
|
23
|
+
"url": "git+https://gitlab.com/bitspur/frappe/multiplatform.one.git",
|
|
24
|
+
"directory": "public/config"
|
|
24
25
|
},
|
|
25
26
|
"source": "src/index.ts",
|
|
26
27
|
"files": [
|
|
27
28
|
"src",
|
|
28
29
|
"lib",
|
|
29
30
|
"tsconfig",
|
|
30
|
-
"README.md"
|
|
31
|
+
"README.md",
|
|
32
|
+
"!tsconfig/dist",
|
|
33
|
+
"!tsconfig/types",
|
|
34
|
+
"types",
|
|
35
|
+
"!types/.tsbuildinfo"
|
|
31
36
|
],
|
|
32
37
|
"type": "module",
|
|
33
38
|
"sideEffects": false,
|
|
34
39
|
"main": "lib/index.js",
|
|
35
40
|
"module": "lib/index.js",
|
|
36
|
-
"types": "
|
|
41
|
+
"types": "types/index.d.ts",
|
|
37
42
|
"exports": {
|
|
38
43
|
"./package.json": "./package.json",
|
|
39
44
|
".": {
|
|
40
45
|
"source": "./src/index.ts",
|
|
41
|
-
"types": "./
|
|
46
|
+
"types": "./types/index.d.ts",
|
|
42
47
|
"import": "./lib/index.js",
|
|
43
48
|
"require": "./lib/index.js"
|
|
44
49
|
},
|
|
45
50
|
"./storybook": {
|
|
46
51
|
"source": "./src/storybook.ts",
|
|
47
|
-
"types": "./
|
|
52
|
+
"types": "./types/storybook.d.ts",
|
|
48
53
|
"import": "./lib/storybook.js",
|
|
49
54
|
"require": "./lib/storybook.js"
|
|
50
55
|
},
|
|
51
56
|
"./vite": {
|
|
52
57
|
"source": "./src/vite.ts",
|
|
53
|
-
"types": "./
|
|
58
|
+
"types": "./types/vite.d.ts",
|
|
54
59
|
"import": "./lib/vite.js",
|
|
55
60
|
"require": "./lib/vite.js"
|
|
56
61
|
},
|
|
57
62
|
"./vitest": {
|
|
58
63
|
"source": "./src/vitest.ts",
|
|
59
|
-
"types": "./
|
|
64
|
+
"types": "./types/vitest.d.ts",
|
|
60
65
|
"import": "./lib/vitest.js",
|
|
61
66
|
"require": "./lib/vitest.js"
|
|
62
67
|
},
|
|
63
68
|
"./playwright": {
|
|
64
69
|
"source": "./src/playwright.ts",
|
|
65
|
-
"types": "./
|
|
70
|
+
"types": "./types/playwright.d.ts",
|
|
66
71
|
"import": "./lib/playwright.js",
|
|
67
72
|
"require": "./lib/playwright.js"
|
|
68
73
|
},
|
|
@@ -82,7 +87,7 @@
|
|
|
82
87
|
"vite-plugin-external": "^6.2.2",
|
|
83
88
|
"vite-plugin-i18next-loader": "^3.1.3",
|
|
84
89
|
"vitest": "^4.1.5",
|
|
85
|
-
"@multiplatform.one/utils": "6.
|
|
90
|
+
"@multiplatform.one/utils": "6.3.0"
|
|
86
91
|
},
|
|
87
92
|
"devDependencies": {
|
|
88
93
|
"tsdown": "^0.21.10",
|
|
@@ -105,6 +110,6 @@
|
|
|
105
110
|
},
|
|
106
111
|
"scripts": {
|
|
107
112
|
"typecheck": "tsc --noEmit",
|
|
108
|
-
"build": "rm -rf lib 2>/dev/null && tsdown"
|
|
113
|
+
"build": "rm -rf lib types 2>/dev/null && tsc -p tsconfig.build.json && tsdown"
|
|
109
114
|
}
|
|
110
115
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
// Pin react-native to its real, resolved location. This monorepo uses
|
|
7
|
+
// pnpm `node-linker=hoisted`, so react-native lives in the repo-root
|
|
8
|
+
// node_modules, not <app>/node_modules. @react-native-community/cli's
|
|
9
|
+
// autolinking defaults reactNativePath to "<project>/node_modules/react-native",
|
|
10
|
+
// which is empty here and breaks CocoaPods ("Couldn't find react-native
|
|
11
|
+
// package.json"). Resolving it explicitly points the Podfile at the hoisted copy.
|
|
12
|
+
reactNativePath: path.dirname(require.resolve("react-native/package.json")),
|
|
13
|
+
commands: [...require("vxrn/react-native-commands")],
|
|
14
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { createStorybookViteConfig } from "./storybook";
|
|
3
|
+
|
|
4
|
+
describe("createStorybookViteConfig", () => {
|
|
5
|
+
const config = createStorybookViteConfig();
|
|
6
|
+
const include = config.optimizeDeps?.include ?? [];
|
|
7
|
+
|
|
8
|
+
it("pre-includes the chart d3 deps so mid-session discovery cannot re-optimize", () => {
|
|
9
|
+
// Regression: d3-shape/d3-scale sit behind dynamically imported story
|
|
10
|
+
// modules (components/src/charts), so vite's initial crawl missed them.
|
|
11
|
+
// Mid-session discovery triggered a re-optimization that bumped every
|
|
12
|
+
// optimized-dep ?v= hash and 504ed ("Outdated Optimize Dep") module
|
|
13
|
+
// graphs loaded before it — FrappeUI stories rendered blank.
|
|
14
|
+
expect(include).toContain("d3-shape");
|
|
15
|
+
expect(include).toContain("d3-scale");
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("pre-includes i18next so its late discovery cannot re-optimize", () => {
|
|
19
|
+
expect(include).toContain("i18next");
|
|
20
|
+
expect(include).toContain("react-i18next");
|
|
21
|
+
});
|
|
22
|
+
});
|
package/src/storybook.ts
CHANGED
|
@@ -117,6 +117,12 @@ export function createStorybookViteConfig(
|
|
|
117
117
|
"@mdx-js/react",
|
|
118
118
|
"i18next",
|
|
119
119
|
"react-i18next",
|
|
120
|
+
// Charts deps (components/src/charts) sit behind dynamically imported
|
|
121
|
+
// story modules, so the initial crawl misses them; discovering them
|
|
122
|
+
// mid-session triggers a re-optimization that bumps every ?v= hash and
|
|
123
|
+
// 504s ("Outdated Optimize Dep") any module graph loaded before it.
|
|
124
|
+
"d3-shape",
|
|
125
|
+
"d3-scale",
|
|
120
126
|
"@storybook-community/storybook-dark-mode",
|
|
121
127
|
// Packages with broken ESM wrappers — advertise "import" condition but
|
|
122
128
|
// the .mjs entry just re-imports a CJS file, or are ESM-only with no
|
package/src/vite.ts
CHANGED
|
@@ -183,6 +183,12 @@ export function createViteConfig(options: CreateViteConfigOptions = {}): UserCon
|
|
|
183
183
|
// resolveId redirects each workspace web entry to its `dist/esm/index.native.js`
|
|
184
184
|
// sibling so native gets the react-native build (the wrappers' native variants).
|
|
185
185
|
registerNativeWorkspaceEntries();
|
|
186
|
+
// @phosphor-icons/react renders DOM <svg>/<path>, which redboxes Hermes
|
|
187
|
+
// ("View config getter callback for component `path` must be a function").
|
|
188
|
+
// phosphor-react-native@3 ships the SAME *Icon-suffixed export names on
|
|
189
|
+
// react-native-svg, so source keeps importing @phosphor-icons/react and
|
|
190
|
+
// native transparently gets the RN implementation.
|
|
191
|
+
registerNativePhosphorIcons();
|
|
186
192
|
}
|
|
187
193
|
|
|
188
194
|
// Tamagui plugin
|
|
@@ -574,6 +580,52 @@ function findProjectRoot(): string {
|
|
|
574
580
|
}
|
|
575
581
|
}
|
|
576
582
|
|
|
583
|
+
/**
|
|
584
|
+
* Resolve `@phosphor-icons/react` to `phosphor-react-native` in the NATIVE
|
|
585
|
+
* graph only. The web package renders DOM `<svg>`/`<path>` and crashes Hermes
|
|
586
|
+
* the moment any icon mounts; the RN package draws the same icon set through
|
|
587
|
+
* react-native-svg and (as of v3) exports identical `*Icon`-suffixed names,
|
|
588
|
+
* so app/library source needs no platform splits. Skipped (with a warning)
|
|
589
|
+
* when phosphor-react-native isn't installed in the consuming project.
|
|
590
|
+
*/
|
|
591
|
+
function registerNativePhosphorIcons(): void {
|
|
592
|
+
const g = globalThis as unknown as { __vxrnAddNativePlugins?: unknown[] };
|
|
593
|
+
const name = "vxrn-phosphor-native-icons";
|
|
594
|
+
g.__vxrnAddNativePlugins = g.__vxrnAddNativePlugins ?? [];
|
|
595
|
+
if (g.__vxrnAddNativePlugins.some((p) => (p as { name?: string })?.name === name)) return;
|
|
596
|
+
let nativeEntry: string | null = null;
|
|
597
|
+
try {
|
|
598
|
+
// The package's exports map doesn't expose "./package.json", so resolve
|
|
599
|
+
// the entry itself (require condition -> lib/commonjs/index.js) and swap
|
|
600
|
+
// to the ESM build; the icons import react-native-svg.
|
|
601
|
+
const cjsEntry = require.resolve("phosphor-react-native", {
|
|
602
|
+
paths: [findProjectRoot(), process.cwd()],
|
|
603
|
+
});
|
|
604
|
+
const esmEntry = cjsEntry.replace(
|
|
605
|
+
`${path.sep}lib${path.sep}commonjs${path.sep}`,
|
|
606
|
+
`${path.sep}lib${path.sep}module${path.sep}`,
|
|
607
|
+
);
|
|
608
|
+
nativeEntry = fs.existsSync(esmEntry) ? esmEntry : cjsEntry;
|
|
609
|
+
} catch {
|
|
610
|
+
nativeEntry = null;
|
|
611
|
+
}
|
|
612
|
+
g.__vxrnAddNativePlugins.push({
|
|
613
|
+
name,
|
|
614
|
+
resolveId(id: string): string | null {
|
|
615
|
+
if (id !== "@phosphor-icons/react") return null;
|
|
616
|
+
if (!nativeEntry) {
|
|
617
|
+
console.warn(
|
|
618
|
+
"[config] @phosphor-icons/react imported in the native graph but " +
|
|
619
|
+
"phosphor-react-native is not installed — icons will crash Hermes. " +
|
|
620
|
+
"Add phosphor-react-native to your app dependencies.",
|
|
621
|
+
);
|
|
622
|
+
return null;
|
|
623
|
+
}
|
|
624
|
+
return nativeEntry;
|
|
625
|
+
},
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
|
|
577
629
|
/**
|
|
578
630
|
* package.json `exports` cannot branch on whether `dist/` exists. For workspace
|
|
579
631
|
* packages, prefer `dist/esm/index.{mjs,js}` when built; otherwise fall back to
|
|
@@ -30,15 +30,26 @@ export function discoverPublicPackageRoots(workspaceRoot: string): Map<string, s
|
|
|
30
30
|
return byName;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Main entry file for Vite/Storybook-style “compile from source” aliases.
|
|
35
|
+
*
|
|
36
|
+
* These aliases are only consumed by WEB Vite configs (Storybook, SPA), so
|
|
37
|
+
* `.web.*` entries take priority over the plain (native) ones — otherwise a
|
|
38
|
+
* package like @package/fonts resolves to its native index.ts and its
|
|
39
|
+
* web-only side effects (fontsource @font-face CSS imports) never load.
|
|
40
|
+
*/
|
|
34
41
|
export function resolvePackageMainSource(pkgDir: string): string | undefined {
|
|
35
42
|
const candidates = [
|
|
36
43
|
path.join(pkgDir, "src", "index.storybook.ts"),
|
|
37
44
|
path.join(pkgDir, "src", "index.storybook.tsx"),
|
|
45
|
+
path.join(pkgDir, "src", "index.web.ts"),
|
|
46
|
+
path.join(pkgDir, "src", "index.web.tsx"),
|
|
38
47
|
path.join(pkgDir, "src", "index.ts"),
|
|
39
48
|
path.join(pkgDir, "src", "index.tsx"),
|
|
40
49
|
path.join(pkgDir, "index.storybook.ts"),
|
|
41
50
|
path.join(pkgDir, "index.storybook.tsx"),
|
|
51
|
+
path.join(pkgDir, "index.web.ts"),
|
|
52
|
+
path.join(pkgDir, "index.web.tsx"),
|
|
42
53
|
path.join(pkgDir, "index.ts"),
|
|
43
54
|
path.join(pkgDir, "index.tsx"),
|
|
44
55
|
];
|
package/tsconfig/build.json
CHANGED
|
@@ -3,22 +3,49 @@
|
|
|
3
3
|
"display": "Build configuration for multiplatform.one packages",
|
|
4
4
|
"extends": "./base.json",
|
|
5
5
|
"compilerOptions": {
|
|
6
|
-
"outDir": "
|
|
7
|
-
"declarationDir": "
|
|
8
|
-
"tsBuildInfoFile": "
|
|
6
|
+
"outDir": "${configDir}/dist",
|
|
7
|
+
"declarationDir": "${configDir}/types",
|
|
8
|
+
"tsBuildInfoFile": "${configDir}/types/.tsbuildinfo",
|
|
9
|
+
// Resolve sibling workspace packages through their exports `source`
|
|
10
|
+
// condition (listed first in every @multiplatform.one exports map) during
|
|
11
|
+
// declaration emission. This keeps emission order-independent — the
|
|
12
|
+
// components <-> forms <-> rich-text <-> markdown dependency cycles make
|
|
13
|
+
// sibling `types` conditions (emitted types/) unusable as emission inputs —
|
|
14
|
+
// and node_modules resolution (+ preserveSymlinks) keeps sibling sources
|
|
15
|
+
// classified as external library files, not emit candidates.
|
|
16
|
+
"customConditions": ["source"],
|
|
17
|
+
// @react-navigation/* also list `source` (raw .tsx) before `types` in
|
|
18
|
+
// their exports and their sources do not compile under this config; pin
|
|
19
|
+
// them to their published declarations (paths take precedence over
|
|
20
|
+
// exports conditions). Extensionless on purpose: a literal .ts/.d.ts
|
|
21
|
+
// candidate flips resolvedUsingTsExtension and crashes tsc 5.9 when the
|
|
22
|
+
// import specifier has no extension.
|
|
23
|
+
"paths": {
|
|
24
|
+
"@react-navigation/*": [
|
|
25
|
+
"${configDir}/node_modules/@react-navigation/*/lib/typescript/src/index",
|
|
26
|
+
"${configDir}/../../node_modules/@react-navigation/*/lib/typescript/src/index"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
9
29
|
},
|
|
10
|
-
|
|
30
|
+
// ${configDir} prefixes keep these patterns anchored to the EXTENDING
|
|
31
|
+
// package (relative patterns in an extended config rebase against this
|
|
32
|
+
// file's directory, which silently disabled the excludes and let stories/
|
|
33
|
+
// specs into every extender's declaration emission). Only src/ (what
|
|
34
|
+
// packages publish and emit declarations for) plus root-level ambient
|
|
35
|
+
// @types/ are compiled; package-root dev scaffolding (webview/, scratch/,
|
|
36
|
+
// tests/) stays out.
|
|
37
|
+
"include": ["${configDir}/src/**/*", "${configDir}/@types/**/*"],
|
|
11
38
|
"exclude": [
|
|
12
|
-
"tests",
|
|
13
|
-
"types",
|
|
14
|
-
"dist",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"vitest.config.ts",
|
|
22
|
-
"vitest.config.mjs"
|
|
39
|
+
"${configDir}/tests",
|
|
40
|
+
"${configDir}/types",
|
|
41
|
+
"${configDir}/dist",
|
|
42
|
+
"${configDir}/**/*.spec.ts",
|
|
43
|
+
"${configDir}/**/*.spec.tsx",
|
|
44
|
+
"${configDir}/**/*.test.ts",
|
|
45
|
+
"${configDir}/**/*.test.tsx",
|
|
46
|
+
"${configDir}/**/*.stories.ts",
|
|
47
|
+
"${configDir}/**/*.stories.tsx",
|
|
48
|
+
"${configDir}/vitest.config.ts",
|
|
49
|
+
"${configDir}/vitest.config.mjs"
|
|
23
50
|
]
|
|
24
51
|
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createStorybookViteConfig, type CreateStorybookViteConfigOptions } from "./storybook";
|
|
2
|
+
export { createViteConfig, type CreateViteConfigOptions } from "./vite";
|
|
3
|
+
export { createVitestConfig, type CreateVitestConfigOptions } from "./vitest";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,KAAK,gCAAgC,EAAE,MAAM,aAAa,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,QAAQ,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { PlaywrightTestConfig } from "@playwright/test";
|
|
2
|
+
export type PlaywrightBrowser = "chromium" | "firefox" | "webkit" | "mobile-chrome" | "mobile-safari";
|
|
3
|
+
export interface CreatePlaywrightConfigOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Test directory path. Defaults to "./tests/e2e".
|
|
6
|
+
*/
|
|
7
|
+
testDir?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Base URL for tests. Defaults to process.env.BASE_URL || "http://localhost:8000".
|
|
10
|
+
*/
|
|
11
|
+
baseURL?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Browsers to test against.
|
|
14
|
+
* Defaults to ["chromium", "firefox", "webkit", "mobile-chrome", "mobile-safari"].
|
|
15
|
+
*/
|
|
16
|
+
browsers?: PlaywrightBrowser[];
|
|
17
|
+
/**
|
|
18
|
+
* Number of retries. Defaults to 2 in CI, 1 locally.
|
|
19
|
+
*/
|
|
20
|
+
retries?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Number of parallel workers. Defaults to 1.
|
|
23
|
+
*/
|
|
24
|
+
workers?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Global test timeout in ms. Defaults to 60000.
|
|
27
|
+
*/
|
|
28
|
+
timeout?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Run tests fully in parallel. Defaults to false.
|
|
31
|
+
*/
|
|
32
|
+
fullyParallel?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Reporter to use. Defaults to "html".
|
|
35
|
+
*/
|
|
36
|
+
reporter?: PlaywrightTestConfig["reporter"];
|
|
37
|
+
/**
|
|
38
|
+
* Run in headless mode. Defaults to true.
|
|
39
|
+
*/
|
|
40
|
+
headless?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Trace collection strategy. Defaults to "on-first-retry".
|
|
43
|
+
*/
|
|
44
|
+
trace?: "on" | "off" | "on-first-retry" | "on-all-retries" | "retain-on-failure" | "retain-on-first-failure";
|
|
45
|
+
/**
|
|
46
|
+
* Screenshot strategy. Defaults to "only-on-failure".
|
|
47
|
+
*/
|
|
48
|
+
screenshot?: "on" | "off" | "only-on-failure";
|
|
49
|
+
/**
|
|
50
|
+
* Navigation timeout in ms. Defaults to 30000.
|
|
51
|
+
*/
|
|
52
|
+
navigationTimeout?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Action timeout in ms (clicks, fills, etc). Defaults to 10000.
|
|
55
|
+
*/
|
|
56
|
+
actionTimeout?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Forbid test.only in CI. Defaults to true when process.env.CI is set.
|
|
59
|
+
*/
|
|
60
|
+
forbidOnly?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Web server configuration to start before tests.
|
|
63
|
+
*/
|
|
64
|
+
webServer?: PlaywrightTestConfig["webServer"];
|
|
65
|
+
/**
|
|
66
|
+
* Path to a module that is run once before all test files.
|
|
67
|
+
* Useful for global setup like generating auth tokens.
|
|
68
|
+
*/
|
|
69
|
+
globalSetup?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Glob patterns or regexps matching files to ignore.
|
|
72
|
+
* Defaults to undefined (no ignore).
|
|
73
|
+
*/
|
|
74
|
+
testIgnore?: PlaywrightTestConfig["testIgnore"];
|
|
75
|
+
/**
|
|
76
|
+
* Override projects entirely (ignores the browsers option when provided).
|
|
77
|
+
*/
|
|
78
|
+
projects?: PlaywrightTestConfig["projects"];
|
|
79
|
+
/**
|
|
80
|
+
* Additional shared use options merged with defaults.
|
|
81
|
+
*/
|
|
82
|
+
use?: PlaywrightTestConfig["use"];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Creates a shared Playwright configuration for multiplatform.one apps.
|
|
86
|
+
*
|
|
87
|
+
* This abstracts away the boilerplate multi-browser Playwright config,
|
|
88
|
+
* providing sensible defaults for CI/local environments, browser projects,
|
|
89
|
+
* timeouts, and trace/screenshot settings.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* // apps/one/playwright.config.ts
|
|
94
|
+
* import { createPlaywrightConfig } from "@multiplatform.one/config/playwright";
|
|
95
|
+
*
|
|
96
|
+
* export default createPlaywrightConfig();
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* // Custom configuration
|
|
102
|
+
* import { createPlaywrightConfig } from "@multiplatform.one/config/playwright";
|
|
103
|
+
*
|
|
104
|
+
* export default createPlaywrightConfig({
|
|
105
|
+
* testDir: "./tests",
|
|
106
|
+
* browsers: ["chromium", "firefox"],
|
|
107
|
+
* webServer: {
|
|
108
|
+
* command: "pnpm dev --port 3000",
|
|
109
|
+
* url: "http://localhost:3000",
|
|
110
|
+
* reuseExistingServer: true,
|
|
111
|
+
* },
|
|
112
|
+
* });
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export declare function createPlaywrightConfig(options?: CreatePlaywrightConfigOptions): PlaywrightTestConfig;
|
|
116
|
+
//# sourceMappingURL=playwright.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright.d.ts","sourceRoot":"","sources":["../src/playwright.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,SAAS,GACT,QAAQ,GACR,eAAe,GACf,eAAe,CAAC;AAEpB,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAE/B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAE5C;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EACF,IAAI,GACJ,KAAK,GACL,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,yBAAyB,CAAC;IAE9B;;OAEG;IACH,UAAU,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,iBAAiB,CAAC;IAE9C;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAE9C;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAEhD;;OAEG;IACH,QAAQ,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAE5C;;OAEG;IACH,GAAG,CAAC,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC;CACnC;AA6CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,6BAAkC,GAC1C,oBAAoB,CA8CtB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { UserConfig } from "vite";
|
|
2
|
+
export interface CreateStorybookViteConfigOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Absolute path to the monorepo workspace root.
|
|
5
|
+
* Auto-detected by walking up from cwd looking for pnpm-workspace.yaml.
|
|
6
|
+
*/
|
|
7
|
+
workspaceRoot?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Additional resolve aliases merged after auto-discovered ones.
|
|
10
|
+
* Use this for packages outside the standard workspace structure.
|
|
11
|
+
*/
|
|
12
|
+
aliases?: Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Additional Vite plugins appended after the built-in React plugin.
|
|
15
|
+
*/
|
|
16
|
+
plugins?: UserConfig["plugins"];
|
|
17
|
+
/**
|
|
18
|
+
* Additional Vite define values merged with the defaults.
|
|
19
|
+
*/
|
|
20
|
+
define?: UserConfig["define"];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates a Vite configuration for Storybook in the multiplatform.one monorepo.
|
|
24
|
+
*
|
|
25
|
+
* Auto-discovers packages/ entries (multiplatform.one, package, and root
|
|
26
|
+
* multiplatform.one scopes) and every workspace package under public/ with a
|
|
27
|
+
* package.json name (including other scopes such as bitspur). Aliases point at
|
|
28
|
+
* TypeScript source; sub-path exports come from each package exports field.
|
|
29
|
+
*
|
|
30
|
+
* Includes React plugin, node:async_hooks stub, and Storybook optimizeDeps.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* // apps/storybook/vite.config.ts
|
|
35
|
+
* import { createStorybookViteConfig } from "@multiplatform.one/config/storybook";
|
|
36
|
+
*
|
|
37
|
+
* export default createStorybookViteConfig();
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function createStorybookViteConfig(options?: CreateStorybookViteConfigOptions): UserConfig;
|
|
41
|
+
//# sourceMappingURL=storybook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storybook.d.ts","sourceRoot":"","sources":["../src/storybook.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAU,UAAU,EAAE,MAAM,MAAM,CAAC;AAG/C,MAAM,WAAW,gCAAgC;IAC/C;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC;;OAEG;IACH,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAEhC;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,gCAAqC,GAC7C,UAAU,CAiHZ"}
|
package/types/vite.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { UserConfig } from "vite";
|
|
2
|
+
export interface CreateViteConfigOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Absolute path to the project root (directory containing .env files).
|
|
5
|
+
* Defaults to looking up the git root.
|
|
6
|
+
*/
|
|
7
|
+
projectRoot?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Public config keys to expose via VITE_MP_CONFIG.
|
|
10
|
+
* These are typically the `public` keys from features/config.json.
|
|
11
|
+
*/
|
|
12
|
+
publicConfigKeys?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Enable Tamagui plugin. Defaults to true.
|
|
15
|
+
*/
|
|
16
|
+
tamagui?: boolean | {
|
|
17
|
+
/**
|
|
18
|
+
* Tamagui components to include.
|
|
19
|
+
* Defaults to looking up tamaguiModules from package.json files.
|
|
20
|
+
*/
|
|
21
|
+
components?: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Path to the Tamagui config file.
|
|
24
|
+
* Defaults to "./config/tamagui.config.ts".
|
|
25
|
+
*/
|
|
26
|
+
config?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Path to output CSS. Defaults to "./tamagui.css".
|
|
29
|
+
*/
|
|
30
|
+
outputCSS?: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Enable i18next loader plugin. Defaults to false.
|
|
34
|
+
*/
|
|
35
|
+
i18n?: boolean | {
|
|
36
|
+
/**
|
|
37
|
+
* Paths to scan for translation files.
|
|
38
|
+
* Defaults to ["../../features/i18n"].
|
|
39
|
+
*/
|
|
40
|
+
paths?: string[];
|
|
41
|
+
/**
|
|
42
|
+
* How to resolve namespaces. Defaults to "basename".
|
|
43
|
+
*/
|
|
44
|
+
namespaceResolution?: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Enable One framework plugin. Defaults to false.
|
|
48
|
+
* When true, uses sensible defaults for router, web, react, and native.
|
|
49
|
+
*/
|
|
50
|
+
one?: boolean | {
|
|
51
|
+
router?: {
|
|
52
|
+
root?: string;
|
|
53
|
+
};
|
|
54
|
+
web?: {
|
|
55
|
+
deploy?: string;
|
|
56
|
+
defaultRenderMode?: string;
|
|
57
|
+
};
|
|
58
|
+
react?: {
|
|
59
|
+
compiler?: boolean;
|
|
60
|
+
};
|
|
61
|
+
native?: {
|
|
62
|
+
key?: string;
|
|
63
|
+
};
|
|
64
|
+
deps?: Record<string, boolean>;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* SSR configuration. Defaults to reasonable values when One is enabled.
|
|
68
|
+
*/
|
|
69
|
+
ssr?: UserConfig["ssr"];
|
|
70
|
+
/**
|
|
71
|
+
* Server configuration. Merged with defaults.
|
|
72
|
+
*/
|
|
73
|
+
server?: UserConfig["server"];
|
|
74
|
+
/**
|
|
75
|
+
* Additional Vite plugins to include.
|
|
76
|
+
*/
|
|
77
|
+
plugins?: UserConfig["plugins"];
|
|
78
|
+
/**
|
|
79
|
+
* Externalize react-router-dom. Defaults to true when One is enabled.
|
|
80
|
+
*/
|
|
81
|
+
externalReactRouter?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Additional dependency optimizations for SSR.
|
|
84
|
+
*/
|
|
85
|
+
ssrDeps?: {
|
|
86
|
+
include?: string[];
|
|
87
|
+
exclude?: string[];
|
|
88
|
+
external?: string[];
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Entry files for Vite's native SSR dep scanner.
|
|
92
|
+
* Vite follows actual import statements from these files to determine what
|
|
93
|
+
* needs pre-bundling — much more accurate than walking package.json dep trees.
|
|
94
|
+
* Defaults to ["routes/**\/*.{ts,tsx}"] for One framework apps.
|
|
95
|
+
* Only used when `one` is enabled.
|
|
96
|
+
*/
|
|
97
|
+
ssrEntries?: string[];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Creates a shared Vite configuration for multiplatform.one apps.
|
|
101
|
+
*
|
|
102
|
+
* This abstracts away the boilerplate that's typically duplicated across
|
|
103
|
+
* app vite.config.ts files, including Tamagui plugin setup, i18n,
|
|
104
|
+
* env variable loading, SSR configuration, and One framework integration.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* // apps/one/vite.config.ts
|
|
109
|
+
* import { createViteConfig } from "@multiplatform.one/config/vite";
|
|
110
|
+
* import { public as publicConfigKeys } from "../../features/config.json";
|
|
111
|
+
*
|
|
112
|
+
* export default createViteConfig({
|
|
113
|
+
* publicConfigKeys,
|
|
114
|
+
* one: { web: { deploy: "node", defaultRenderMode: "ssr" } },
|
|
115
|
+
* tamagui: { config: "./config/tamagui.config.ts" },
|
|
116
|
+
* i18n: { paths: ["../../features/i18n"] },
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare function createViteConfig(options?: CreateViteConfigOptions): UserConfig;
|
|
121
|
+
export { discoverPublicPackageRoots, publicPackageViteSourceAliases, } from "./workspacePublicPackages.js";
|
|
122
|
+
//# sourceMappingURL=vite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAU,UAAU,EAAE,MAAM,MAAM,CAAC;AAI/C,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE5B;;OAEG;IACH,OAAO,CAAC,EACJ,OAAO,GACP;QACE;;;WAGG;QACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QAEtB;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAEN;;OAEG;IACH,IAAI,CAAC,EACD,OAAO,GACP;QACE;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAEjB;;WAEG;QACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;IAEN;;;OAGG;IACH,GAAG,CAAC,EACA,OAAO,GACP;QACE,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC3B,GAAG,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACtD,KAAK,CAAC,EAAE;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;QAC/B,MAAM,CAAC,EAAE;YAAE,GAAG,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,CAAC;IAEN;;OAEG;IACH,GAAG,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAExB;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAE9B;;OAEG;IACH,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAEhC;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;IAEF;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B,GAAG,UAAU,CA0QlF;AAED,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { UserConfig } from "vite";
|
|
2
|
+
export interface CreateVitestConfigOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Path to the Tamagui config file for test environments.
|
|
5
|
+
* Defaults to "./tests/tamagui.config.ts".
|
|
6
|
+
* Set to false to disable the Tamagui plugin.
|
|
7
|
+
*/
|
|
8
|
+
tamaguiConfig?: string | false;
|
|
9
|
+
/**
|
|
10
|
+
* Test environment. Defaults to "jsdom".
|
|
11
|
+
*/
|
|
12
|
+
environment?: "jsdom" | "happy-dom" | "node";
|
|
13
|
+
/**
|
|
14
|
+
* Setup files to run before tests.
|
|
15
|
+
*/
|
|
16
|
+
setupFiles?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Test timeout in ms. Defaults to 30000.
|
|
19
|
+
*/
|
|
20
|
+
testTimeout?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Additional deps to inline in test server.
|
|
23
|
+
*/
|
|
24
|
+
inlineDeps?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* Dependencies to externalize in test server (server.deps.external).
|
|
27
|
+
*/
|
|
28
|
+
externalDeps?: string[];
|
|
29
|
+
/**
|
|
30
|
+
* Additional resolve aliases.
|
|
31
|
+
*/
|
|
32
|
+
aliases?: Record<string, string>;
|
|
33
|
+
/**
|
|
34
|
+
* Coverage configuration overrides.
|
|
35
|
+
*/
|
|
36
|
+
coverage?: {
|
|
37
|
+
exclude?: string[];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Whether to replace react-native imports with react-native-web.
|
|
41
|
+
* Defaults to true.
|
|
42
|
+
*/
|
|
43
|
+
replaceReactNative?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether to deduplicate React to root node_modules.
|
|
46
|
+
* Defaults to true. Prevents "multiple React instances" errors in monorepo.
|
|
47
|
+
*/
|
|
48
|
+
dedupeReact?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Absolute path to root node_modules for React deduplication.
|
|
51
|
+
* Defaults to ../../node_modules relative to cwd.
|
|
52
|
+
*/
|
|
53
|
+
rootNodeModules?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Additional resolve conditions. Defaults to ["source", "test", "browser"].
|
|
56
|
+
*/
|
|
57
|
+
conditions?: string[];
|
|
58
|
+
/**
|
|
59
|
+
* Test include patterns. Defaults to vitest default.
|
|
60
|
+
*/
|
|
61
|
+
include?: string[];
|
|
62
|
+
/**
|
|
63
|
+
* Test exclude patterns. Defaults to vitest default.
|
|
64
|
+
*/
|
|
65
|
+
exclude?: string[];
|
|
66
|
+
/**
|
|
67
|
+
* Whether to pass when no tests are found. Defaults to false.
|
|
68
|
+
*/
|
|
69
|
+
passWithNoTests?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Creates a shared Vitest configuration for multiplatform.one packages.
|
|
73
|
+
*
|
|
74
|
+
* This eliminates the ~100 lines of duplicated vitest config across 13+ packages,
|
|
75
|
+
* handling Tamagui transforms, react-native-web replacement, React deduplication,
|
|
76
|
+
* and consistent coverage/environment settings.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* // packages/components/vitest.config.mjs
|
|
81
|
+
* import { createVitestConfig } from "@multiplatform.one/config/vitest";
|
|
82
|
+
*
|
|
83
|
+
* export default createVitestConfig({
|
|
84
|
+
* setupFiles: ["./tests/setup.tsx"],
|
|
85
|
+
* tamaguiConfig: "../../features/tamagui.config.ts",
|
|
86
|
+
* });
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function createVitestConfig(options?: CreateVitestConfigOptions): UserConfig;
|
|
90
|
+
//# sourceMappingURL=vitest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../src/vitest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAE/B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,MAAM,CAAC;IAE7C;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IAEF;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,yBAA8B,GAAG,UAAU,CAmJtF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every direct child of `public/` with a `package.json` `name` is treated as a
|
|
3
|
+
* publishable workspace package (same rule as Metro in `apps/storybook-expo`).
|
|
4
|
+
*
|
|
5
|
+
* Tamagui’s internal esbuild (bundling `tamagui.config` + `components`) reads
|
|
6
|
+
* `compilerOptions.paths` from the repo `tsconfig.base.json` chain, including
|
|
7
|
+
* `tamagui-workspace-paths.generated.json` (see `scripts/generate-tamagui-workspace-paths.mjs`).
|
|
8
|
+
*/
|
|
9
|
+
export declare function discoverPublicPackageRoots(workspaceRoot: string): Map<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Main entry file for Vite/Storybook-style “compile from source” aliases.
|
|
12
|
+
*
|
|
13
|
+
* These aliases are only consumed by WEB Vite configs (Storybook, SPA), so
|
|
14
|
+
* `.web.*` entries take priority over the plain (native) ones — otherwise a
|
|
15
|
+
* package like @package/fonts resolves to its native index.ts and its
|
|
16
|
+
* web-only side effects (fontsource @font-face CSS imports) never load.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolvePackageMainSource(pkgDir: string): string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Vite `resolve.alias` entries: each public package name → its TypeScript main.
|
|
21
|
+
* For SPA / ad-hoc Vite configs that should not list packages by hand.
|
|
22
|
+
*/
|
|
23
|
+
export declare function publicPackageViteSourceAliases(workspaceRoot: string): Record<string, string>;
|
|
24
|
+
//# sourceMappingURL=workspacePublicPackages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspacePublicPackages.d.ts","sourceRoot":"","sources":["../src/workspacePublicPackages.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAmBrF;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgB3E;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO5F"}
|