@multiplatform.one/config 7.83.1 → 7.84.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 +2 -2
- package/lib/{storybook-B4xUN1sj.js → storybook-8fDh89nY.js} +1 -1
- package/lib/storybook.js +1 -1
- package/lib/{vite-DgGEtpf6.js → vite-CC7eGxtQ.js} +1 -44
- package/lib/vite.js +2 -2
- package/lib/vitest.js +17 -2
- package/lib/{workspacePublicPackages-CQ-maBQI.js → workspacePublicPackages-uFiITxJO.js} +116 -73
- package/package.json +3 -2
- package/src/emittingTsconfigPaths.spec.ts +4 -2
- package/src/storybook.spec.ts +18 -3
- package/src/vitest.spec.ts +104 -2
- package/src/vitest.ts +19 -2
- package/src/workspacePublicPackages.ts +3 -88
- package/types/vitest.d.ts.map +1 -1
- package/types/workspacePublicPackages.d.ts +1 -16
- package/types/workspacePublicPackages.d.ts.map +1 -1
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createViteConfig } from "./vite-
|
|
1
|
+
import { t as createViteConfig } from "./vite-CC7eGxtQ.js";
|
|
2
2
|
import { i as phosphorTokenColorPlugin, n as tamaguiWorkspacePathsFile, t as ensureTamaguiWorkspacePaths } from "./tamaguiWorkspacePaths-DR3dud79.js";
|
|
3
|
-
import { t as createStorybookViteConfig } from "./storybook-
|
|
3
|
+
import { t as createStorybookViteConfig } from "./storybook-8fDh89nY.js";
|
|
4
4
|
import { createVitestConfig } from "./vitest.js";
|
|
5
5
|
|
|
6
6
|
export { createStorybookViteConfig, createViteConfig, createVitestConfig, ensureTamaguiWorkspacePaths, phosphorTokenColorPlugin, tamaguiWorkspacePathsFile };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as phosphorTokenColorPlugin, t as ensureTamaguiWorkspacePaths } from "./tamaguiWorkspacePaths-DR3dud79.js";
|
|
2
|
-
import {
|
|
2
|
+
import { c as withSingletonDepAliases, r as resolvePackageMainSource, t as discoverPublicPackageRoots } from "./workspacePublicPackages-uFiITxJO.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
package/lib/storybook.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { i as phosphorTokenColorPlugin, t as ensureTamaguiWorkspacePaths } from "./tamaguiWorkspacePaths-DR3dud79.js";
|
|
2
|
-
import { i as resolveWorkspaceNativeEntry, o as
|
|
2
|
+
import { c as withSingletonDepAliases, i as resolveWorkspaceNativeEntry, o as lookupTamaguiModules, s as resolveConfig, t as discoverPublicPackageRoots } from "./workspacePublicPackages-uFiITxJO.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
|
-
import { spawnSync } from "node:child_process";
|
|
7
6
|
import dotenv from "dotenv";
|
|
8
7
|
import { transformWithOxc } from "vite";
|
|
9
8
|
import { tamaguiPlugin } from "@tamagui/vite-plugin";
|
|
@@ -13,48 +12,6 @@ import i18nextLoader from "vite-plugin-i18next-loader";
|
|
|
13
12
|
//#region \0rolldown/runtime.js
|
|
14
13
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
15
14
|
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region ../utils/src/dev.ts
|
|
18
|
-
const logger = console;
|
|
19
|
-
function lookupTamaguiModules(packageDirs, { log = true } = {}) {
|
|
20
|
-
const projectRoot = lookupProjectRoot();
|
|
21
|
-
const tamaguiModules = [...new Set(["tamagui", ...[...new Set([
|
|
22
|
-
projectRoot,
|
|
23
|
-
path.resolve(projectRoot, "app"),
|
|
24
|
-
path.resolve(projectRoot, "features"),
|
|
25
|
-
...packageDirs || []
|
|
26
|
-
])].map((packageDir) => {
|
|
27
|
-
const pkgPath = path.join(packageDir, "package.json");
|
|
28
|
-
if (!fs.existsSync(pkgPath)) return [];
|
|
29
|
-
try {
|
|
30
|
-
return JSON.parse(fs.readFileSync(pkgPath, "utf-8")).tamaguiModules || [];
|
|
31
|
-
} catch (err) {
|
|
32
|
-
if (log) logger.error(err);
|
|
33
|
-
return [];
|
|
34
|
-
}
|
|
35
|
-
})])].flat();
|
|
36
|
-
if (log) logger.debug("tamaguiModules:", tamaguiModules.join(", "));
|
|
37
|
-
return tamaguiModules;
|
|
38
|
-
}
|
|
39
|
-
function resolveConfig(keys = []) {
|
|
40
|
-
return keys.reduce((acc, key) => {
|
|
41
|
-
if (process.env[key]) acc[key] = process.env[key];
|
|
42
|
-
return acc;
|
|
43
|
-
}, {});
|
|
44
|
-
}
|
|
45
|
-
let _projectRoot;
|
|
46
|
-
function lookupProjectRoot() {
|
|
47
|
-
if (_projectRoot) return _projectRoot;
|
|
48
|
-
try {
|
|
49
|
-
const { stdout } = spawnSync("git", ["rev-parse", "--show-toplevel"], { encoding: "utf-8" });
|
|
50
|
-
_projectRoot = stdout.trim();
|
|
51
|
-
return _projectRoot;
|
|
52
|
-
} catch {
|
|
53
|
-
_projectRoot = process.cwd();
|
|
54
|
-
return _projectRoot;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
15
|
//#endregion
|
|
59
16
|
//#region src/publicConfig.ts
|
|
60
17
|
const bakedConfigEnvKey = "VITE_MP_CONFIG";
|
package/lib/vite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as readPublicConfigKeys, i as publicConfigPlugin, n as phosphorNativeIconBase, r as phosphorNativeIconBaseId, t as createViteConfig } from "./vite-
|
|
1
|
+
import { a as readPublicConfigKeys, i as publicConfigPlugin, n as phosphorNativeIconBase, r as phosphorNativeIconBaseId, t as createViteConfig } from "./vite-CC7eGxtQ.js";
|
|
2
2
|
import { i as phosphorTokenColorPlugin } from "./tamaguiWorkspacePaths-DR3dud79.js";
|
|
3
|
-
import { a as staleNativeDistSource, i as resolveWorkspaceNativeEntry, n as publicPackageViteSourceAliases, t as discoverPublicPackageRoots } from "./workspacePublicPackages-
|
|
3
|
+
import { a as staleNativeDistSource, i as resolveWorkspaceNativeEntry, n as publicPackageViteSourceAliases, t as discoverPublicPackageRoots } from "./workspacePublicPackages-uFiITxJO.js";
|
|
4
4
|
|
|
5
5
|
export { createViteConfig, discoverPublicPackageRoots, phosphorNativeIconBase, phosphorNativeIconBaseId, phosphorTokenColorPlugin, publicConfigPlugin, publicPackageViteSourceAliases, readPublicConfigKeys, resolveWorkspaceNativeEntry, staleNativeDistSource };
|
package/lib/vitest.js
CHANGED
|
@@ -2,12 +2,26 @@ import { i as phosphorTokenColorPlugin, r as phosphorBarrelBundlePlugin, t as en
|
|
|
2
2
|
import Module from "node:module";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
6
|
import { tamaguiPlugin } from "@tamagui/vite-plugin";
|
|
7
|
+
import { resolvePathSync } from "mlly";
|
|
7
8
|
import react from "@vitejs/plugin-react";
|
|
8
9
|
|
|
9
10
|
//#region src/vitest.ts
|
|
10
11
|
const pinReactRequireSetup = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../pin-react-require.cjs");
|
|
12
|
+
function resolveSetupFile(file, conditions) {
|
|
13
|
+
if (file.startsWith(".") || path.isAbsolute(file) || /^[a-z][a-z\d+.-]*:/i.test(file)) return file;
|
|
14
|
+
try {
|
|
15
|
+
return resolvePathSync(file, {
|
|
16
|
+
url: pathToFileURL(path.join(process.cwd(), "vitest.config.js")),
|
|
17
|
+
conditions: [...conditions, "import"],
|
|
18
|
+
extensions: []
|
|
19
|
+
});
|
|
20
|
+
} catch (error) {
|
|
21
|
+
if (error.code === "ERR_MODULE_NOT_FOUND") return file;
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
11
25
|
/**
|
|
12
26
|
* The coverage SonarQube reads (FZ-8866). With MPO_COVERAGE=1, CI's test-vitest
|
|
13
27
|
* measures every run as lcov, even a failing one. Each vitest process writes
|
|
@@ -117,10 +131,11 @@ function createVitestConfig(options = {}) {
|
|
|
117
131
|
process.env.MPO_VITEST_SCHEDULER = schedulerDir;
|
|
118
132
|
pinNodeReactRequire(reactDir, reactDomDir, schedulerDir);
|
|
119
133
|
}
|
|
134
|
+
const resolvedSetupFiles = setupFiles.map((file) => resolveSetupFile(file, conditions));
|
|
120
135
|
const testConfig = {
|
|
121
136
|
environment,
|
|
122
137
|
globals: true,
|
|
123
|
-
setupFiles: dedupeReact ? [pinReactRequireSetup, ...
|
|
138
|
+
setupFiles: dedupeReact ? [pinReactRequireSetup, ...resolvedSetupFiles] : resolvedSetupFiles,
|
|
124
139
|
testTimeout,
|
|
125
140
|
coverage: {
|
|
126
141
|
provider: "v8",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
4
5
|
|
|
5
6
|
//#region src/singletonDepAliases.ts
|
|
6
7
|
/**
|
|
@@ -158,6 +159,120 @@ function resolvePackageDir(pkgName, root, requireFrom) {
|
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
161
|
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region ../utils/src/dev.ts
|
|
164
|
+
const logger = console;
|
|
165
|
+
function lookupTamaguiModules(packageDirs, { log = true } = {}) {
|
|
166
|
+
const projectRoot = lookupProjectRoot();
|
|
167
|
+
const tamaguiModules = [...new Set(["tamagui", ...[...new Set([
|
|
168
|
+
projectRoot,
|
|
169
|
+
path.resolve(projectRoot, "app"),
|
|
170
|
+
path.resolve(projectRoot, "features"),
|
|
171
|
+
...packageDirs || []
|
|
172
|
+
])].map((packageDir) => {
|
|
173
|
+
const pkgPath = path.join(packageDir, "package.json");
|
|
174
|
+
if (!fs.existsSync(pkgPath)) return [];
|
|
175
|
+
try {
|
|
176
|
+
return JSON.parse(fs.readFileSync(pkgPath, "utf-8")).tamaguiModules || [];
|
|
177
|
+
} catch (err) {
|
|
178
|
+
if (log) logger.error(err);
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
})])].flat();
|
|
182
|
+
if (log) logger.debug("tamaguiModules:", tamaguiModules.join(", "));
|
|
183
|
+
return tamaguiModules;
|
|
184
|
+
}
|
|
185
|
+
function resolveConfig(keys = []) {
|
|
186
|
+
return keys.reduce((acc, key) => {
|
|
187
|
+
if (process.env[key]) acc[key] = process.env[key];
|
|
188
|
+
return acc;
|
|
189
|
+
}, {});
|
|
190
|
+
}
|
|
191
|
+
let _projectRoot;
|
|
192
|
+
function lookupProjectRoot() {
|
|
193
|
+
if (_projectRoot) return _projectRoot;
|
|
194
|
+
try {
|
|
195
|
+
const { stdout } = spawnSync("git", ["rev-parse", "--show-toplevel"], { encoding: "utf-8" });
|
|
196
|
+
_projectRoot = stdout.trim();
|
|
197
|
+
return _projectRoot;
|
|
198
|
+
} catch {
|
|
199
|
+
_projectRoot = process.cwd();
|
|
200
|
+
return _projectRoot;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const webConditionOrder = [
|
|
204
|
+
"import",
|
|
205
|
+
"default",
|
|
206
|
+
"require"
|
|
207
|
+
];
|
|
208
|
+
const skippedConditions = new Set(["types", "react-native"]);
|
|
209
|
+
const tsSourcePattern = /\.(c|m)?tsx?$/;
|
|
210
|
+
function collectExportTargets(target, out) {
|
|
211
|
+
if (typeof target === "string") {
|
|
212
|
+
out.push(target);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (!target) return;
|
|
216
|
+
if (Array.isArray(target)) {
|
|
217
|
+
for (const item of target) collectExportTargets(item, out);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (typeof target.source === "string") out.push(target.source);
|
|
221
|
+
const keys = Object.keys(target).filter((k) => k !== "source" && !skippedConditions.has(k));
|
|
222
|
+
const ordered = [...webConditionOrder.filter((k) => keys.includes(k)), ...keys.filter((k) => !webConditionOrder.includes(k))];
|
|
223
|
+
for (const key of ordered) collectExportTargets(target[key], out);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* The file a web build should compile for one `exports` entry: its `source`
|
|
227
|
+
* condition, else the first TypeScript file among its web conditions, else
|
|
228
|
+
* the first existing file (css, a prebuilt .mjs), so the package-name alias
|
|
229
|
+
* never swallows a subpath it cannot see.
|
|
230
|
+
*/
|
|
231
|
+
function resolveExportSource(pkgDir, target) {
|
|
232
|
+
const candidates = [];
|
|
233
|
+
collectExportTargets(target, candidates);
|
|
234
|
+
const existing = candidates.map((c) => path.resolve(pkgDir, c)).filter((c) => !c.endsWith(".d.ts") && fs.existsSync(c) && fs.statSync(c).isFile());
|
|
235
|
+
return existing.find((c) => tsSourcePattern.test(c)) ?? existing[0];
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The file a subpath declares when none of its targets is on disk yet, such
|
|
239
|
+
* as a prebuilt `./dist/...` asset in an unbuilt tree. Aliasing it keeps the
|
|
240
|
+
* bare package alias from rewriting the subpath into `src/index.ts/<subpath>`,
|
|
241
|
+
* so a missing build fails on the real path. Types-only subpaths get none.
|
|
242
|
+
*/
|
|
243
|
+
function declaredExportTarget(pkgDir, target) {
|
|
244
|
+
const candidates = [];
|
|
245
|
+
collectExportTargets(target, candidates);
|
|
246
|
+
const runtime = candidates.find((c) => !c.endsWith(".d.ts"));
|
|
247
|
+
return runtime ? path.resolve(pkgDir, runtime) : void 0;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Vite `resolve.alias` entries for one package's `exports` subpaths:
|
|
251
|
+
* `<name>/<subpath>` → its source file, and a `./dir/*` pattern → the directory.
|
|
252
|
+
*/
|
|
253
|
+
function packageSubpathSourceAliases(pkgName, pkgDir, exportsField) {
|
|
254
|
+
const aliases = {};
|
|
255
|
+
if (!exportsField || typeof exportsField !== "object" || Array.isArray(exportsField)) return aliases;
|
|
256
|
+
for (const [key, target] of Object.entries(exportsField)) {
|
|
257
|
+
if (key === "." || key === "./package.json" || !key.startsWith("./")) continue;
|
|
258
|
+
if (key.endsWith("/*")) {
|
|
259
|
+
const pattern = key.slice(2, -2);
|
|
260
|
+
if (pattern.includes("*")) continue;
|
|
261
|
+
const targets = [];
|
|
262
|
+
collectExportTargets(target, targets);
|
|
263
|
+
const dirTarget = targets.find((t) => t.endsWith("/*"));
|
|
264
|
+
if (!dirTarget) continue;
|
|
265
|
+
const dir = path.resolve(pkgDir, dirTarget.slice(0, -2));
|
|
266
|
+
if (fs.existsSync(dir) && fs.statSync(dir).isDirectory()) aliases[`${pkgName}/${pattern}`] = dir;
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
if (key.includes("*")) continue;
|
|
270
|
+
const file = resolveExportSource(pkgDir, target) ?? declaredExportTarget(pkgDir, target);
|
|
271
|
+
if (file) aliases[`${pkgName}/${key.slice(2)}`] = file;
|
|
272
|
+
}
|
|
273
|
+
return aliases;
|
|
274
|
+
}
|
|
275
|
+
|
|
161
276
|
//#endregion
|
|
162
277
|
//#region src/workspacePublicPackages.ts
|
|
163
278
|
/**
|
|
@@ -270,78 +385,6 @@ function resolvePackageMainSource(pkgDir) {
|
|
|
270
385
|
path.join(pkgDir, "index.tsx")
|
|
271
386
|
].find((c) => fs.existsSync(c));
|
|
272
387
|
}
|
|
273
|
-
const webConditionOrder = [
|
|
274
|
-
"import",
|
|
275
|
-
"default",
|
|
276
|
-
"require"
|
|
277
|
-
];
|
|
278
|
-
const skippedConditions = new Set(["types", "react-native"]);
|
|
279
|
-
const tsSourcePattern = /\.(c|m)?tsx?$/;
|
|
280
|
-
function collectExportTargets(target, out) {
|
|
281
|
-
if (typeof target === "string") {
|
|
282
|
-
out.push(target);
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
if (!target) return;
|
|
286
|
-
if (Array.isArray(target)) {
|
|
287
|
-
for (const item of target) collectExportTargets(item, out);
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
if (typeof target.source === "string") out.push(target.source);
|
|
291
|
-
const keys = Object.keys(target).filter((k) => k !== "source" && !skippedConditions.has(k));
|
|
292
|
-
const ordered = [...webConditionOrder.filter((k) => keys.includes(k)), ...keys.filter((k) => !webConditionOrder.includes(k))];
|
|
293
|
-
for (const key of ordered) collectExportTargets(target[key], out);
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* The file a web build should compile for one `exports` entry: its `source`
|
|
297
|
-
* condition, else the first TypeScript file among its web conditions, else
|
|
298
|
-
* the first existing file (css, a prebuilt .mjs), so the package-name alias
|
|
299
|
-
* never swallows a subpath it cannot see.
|
|
300
|
-
*/
|
|
301
|
-
function resolveExportSource(pkgDir, target) {
|
|
302
|
-
const candidates = [];
|
|
303
|
-
collectExportTargets(target, candidates);
|
|
304
|
-
const existing = candidates.map((c) => path.resolve(pkgDir, c)).filter((c) => !c.endsWith(".d.ts") && fs.existsSync(c) && fs.statSync(c).isFile());
|
|
305
|
-
return existing.find((c) => tsSourcePattern.test(c)) ?? existing[0];
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* The file a subpath declares when none of its targets is on disk yet, such
|
|
309
|
-
* as a prebuilt `./dist/...` asset in an unbuilt tree. Aliasing it keeps the
|
|
310
|
-
* bare package alias from rewriting the subpath into `src/index.ts/<subpath>`,
|
|
311
|
-
* so a missing build fails on the real path. Types-only subpaths get none.
|
|
312
|
-
*/
|
|
313
|
-
function declaredExportTarget(pkgDir, target) {
|
|
314
|
-
const candidates = [];
|
|
315
|
-
collectExportTargets(target, candidates);
|
|
316
|
-
const runtime = candidates.find((c) => !c.endsWith(".d.ts"));
|
|
317
|
-
return runtime ? path.resolve(pkgDir, runtime) : void 0;
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Vite `resolve.alias` entries for one package's `exports` subpaths:
|
|
321
|
-
* `<name>/<subpath>` → its source file, and a `./dir/*` pattern → the directory.
|
|
322
|
-
*/
|
|
323
|
-
function packageSubpathSourceAliases(pkgName, pkgDir, exportsField) {
|
|
324
|
-
const aliases = {};
|
|
325
|
-
if (!exportsField || typeof exportsField !== "object" || Array.isArray(exportsField)) return aliases;
|
|
326
|
-
for (const [key, target] of Object.entries(exportsField)) {
|
|
327
|
-
if (key === "." || key === "./package.json" || !key.startsWith("./")) continue;
|
|
328
|
-
if (key.endsWith("/*")) {
|
|
329
|
-
const pattern = key.slice(2, -2);
|
|
330
|
-
if (pattern.includes("*")) continue;
|
|
331
|
-
const targets = [];
|
|
332
|
-
collectExportTargets(target, targets);
|
|
333
|
-
const dirTarget = targets.find((t) => t.endsWith("/*"));
|
|
334
|
-
if (!dirTarget) continue;
|
|
335
|
-
const dir = path.resolve(pkgDir, dirTarget.slice(0, -2));
|
|
336
|
-
if (fs.existsSync(dir) && fs.statSync(dir).isDirectory()) aliases[`${pkgName}/${pattern}`] = dir;
|
|
337
|
-
continue;
|
|
338
|
-
}
|
|
339
|
-
if (key.includes("*")) continue;
|
|
340
|
-
const file = resolveExportSource(pkgDir, target) ?? declaredExportTarget(pkgDir, target);
|
|
341
|
-
if (file) aliases[`${pkgName}/${key.slice(2)}`] = file;
|
|
342
|
-
}
|
|
343
|
-
return aliases;
|
|
344
|
-
}
|
|
345
388
|
/**
|
|
346
389
|
* Vite `resolve.alias` entries: each public package name → its TypeScript
|
|
347
390
|
* main, plus every `exports` subpath → its own source file. For SPA / ad-hoc
|
|
@@ -375,4 +418,4 @@ function publicPackageViteSourceAliases(workspaceRoot) {
|
|
|
375
418
|
}
|
|
376
419
|
|
|
377
420
|
//#endregion
|
|
378
|
-
export { staleNativeDistSource as a, resolveWorkspaceNativeEntry as i, publicPackageViteSourceAliases as n,
|
|
421
|
+
export { staleNativeDistSource as a, withSingletonDepAliases as c, resolveWorkspaceNativeEntry as i, publicPackageViteSourceAliases as n, lookupTamaguiModules as o, resolvePackageMainSource as r, resolveConfig as s, discoverPublicPackageRoots as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/config",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.84.0",
|
|
4
4
|
"description": "Shared build and test configuration presets for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -114,11 +114,12 @@
|
|
|
114
114
|
"access": "public"
|
|
115
115
|
},
|
|
116
116
|
"dependencies": {
|
|
117
|
-
"@multiplatform.one/utils": "^7.
|
|
117
|
+
"@multiplatform.one/utils": "^7.84.0",
|
|
118
118
|
"@tamagui/vite-plugin": "2.7.6",
|
|
119
119
|
"@vitejs/plugin-react": "^6.1.2",
|
|
120
120
|
"dotenv": "^17.4.2",
|
|
121
121
|
"fast-flow-transform": "^0.0.3",
|
|
122
|
+
"mlly": "^1.8.2",
|
|
122
123
|
"typescript": "~5.9.3",
|
|
123
124
|
"vite": "^8.0.10",
|
|
124
125
|
"vite-plugin-external": "^6.2.2",
|
|
@@ -45,9 +45,11 @@ function buildConfigs(): { pkg: string; file: string; doc: any }[] {
|
|
|
45
45
|
if (!fs.existsSync(pkgJson)) continue;
|
|
46
46
|
const build = JSON.parse(fs.readFileSync(pkgJson, "utf8"))?.scripts?.build;
|
|
47
47
|
if (typeof build !== "string") continue;
|
|
48
|
-
const
|
|
48
|
+
const compiler = build.match(/\b(tsc|tamagui-build)\b([^;&]*)/);
|
|
49
|
+
if (!compiler) continue;
|
|
50
|
+
const named = compiler[2].match(/(?:^|\s)(?:-p|--project|--ts-project)\s+(\S+)/)?.[1];
|
|
49
51
|
const file = path.join(publicDir, entry.name, named ?? "tsconfig.json");
|
|
50
|
-
if (
|
|
52
|
+
if (!fs.existsSync(file)) continue;
|
|
51
53
|
found.push({ pkg: entry.name, file, doc: readJsonc(file) });
|
|
52
54
|
}
|
|
53
55
|
return found;
|
package/src/storybook.spec.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
4
|
import { createStorybookViteConfig } from "./storybook";
|
|
3
5
|
|
|
4
6
|
describe("createStorybookViteConfig", () => {
|
|
@@ -15,11 +17,24 @@ describe("createStorybookViteConfig", () => {
|
|
|
15
17
|
expect(include).toContain("d3-scale");
|
|
16
18
|
});
|
|
17
19
|
|
|
18
|
-
it("aliases
|
|
20
|
+
it("aliases a subpath to workspace source with or without its Metro shim", () => {
|
|
19
21
|
const alias = config.resolve?.alias as Record<string, string>;
|
|
20
22
|
expect(alias["@multiplatform.one/theme/scale-attribute"]).toMatch(
|
|
21
|
-
/public\/theme\/
|
|
23
|
+
/public\/theme\/scale-attribute\.ts$/,
|
|
22
24
|
);
|
|
25
|
+
const existsSync = fs.existsSync;
|
|
26
|
+
const shim = path.join("public", "theme", "scale-attribute.ts");
|
|
27
|
+
const existsSpy = vi
|
|
28
|
+
.spyOn(fs, "existsSync")
|
|
29
|
+
.mockImplementation((file) => !String(file).endsWith(shim) && existsSync(file));
|
|
30
|
+
try {
|
|
31
|
+
const withoutShim = createStorybookViteConfig().resolve?.alias as Record<string, string>;
|
|
32
|
+
expect(withoutShim["@multiplatform.one/theme/scale-attribute"]).toMatch(
|
|
33
|
+
/public\/theme\/src\/theme\/scale\/scaleAttribute\.ts$/,
|
|
34
|
+
);
|
|
35
|
+
} finally {
|
|
36
|
+
existsSpy.mockRestore();
|
|
37
|
+
}
|
|
23
38
|
});
|
|
24
39
|
|
|
25
40
|
it("pre-includes i18next so its late discovery cannot re-optimize", () => {
|
package/src/vitest.spec.ts
CHANGED
|
@@ -14,10 +14,12 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import fs from "node:fs";
|
|
17
|
+
import os from "node:os";
|
|
17
18
|
import path from "node:path";
|
|
18
|
-
import { fileURLToPath } from "node:url";
|
|
19
|
-
import { afterAll, describe, expect, it, vi } from "vitest";
|
|
19
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
20
|
+
import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
20
21
|
import type { ViteUserConfig } from "vitest/config";
|
|
22
|
+
import { resolveConfig } from "vitest/node";
|
|
21
23
|
import { createServer, type ViteDevServer } from "vite";
|
|
22
24
|
import { createVitestConfig } from "./vitest.js";
|
|
23
25
|
|
|
@@ -179,3 +181,103 @@ describe("coverage for SonarQube (FZ-8866)", () => {
|
|
|
179
181
|
vi.unstubAllEnvs();
|
|
180
182
|
});
|
|
181
183
|
});
|
|
184
|
+
|
|
185
|
+
describe("setupFiles bare specifiers (FZ-8926)", () => {
|
|
186
|
+
let root: string;
|
|
187
|
+
let packageDir: string;
|
|
188
|
+
let source: string;
|
|
189
|
+
|
|
190
|
+
beforeEach(() => {
|
|
191
|
+
root = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), "mpo-setup-"));
|
|
192
|
+
packageDir = path.join(root, "node_modules/@fixture/setup-pkg");
|
|
193
|
+
source = path.join(packageDir, "src/setup.ts");
|
|
194
|
+
fs.mkdirSync(path.dirname(source), { recursive: true });
|
|
195
|
+
fs.writeFileSync(source, "export const ready: boolean = true;\n");
|
|
196
|
+
fs.writeFileSync(
|
|
197
|
+
path.join(packageDir, "package.json"),
|
|
198
|
+
JSON.stringify({
|
|
199
|
+
name: "@fixture/setup-pkg",
|
|
200
|
+
type: "module",
|
|
201
|
+
exports: {
|
|
202
|
+
"./setup": {
|
|
203
|
+
source: "./src/setup.ts",
|
|
204
|
+
types: "./types/setup.d.ts",
|
|
205
|
+
import: "./dist/setup.mjs",
|
|
206
|
+
require: "./dist/setup.cjs",
|
|
207
|
+
default: "./dist/setup.mjs",
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
}),
|
|
211
|
+
);
|
|
212
|
+
vi.spyOn(process, "cwd").mockReturnValue(root);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
afterEach(() => {
|
|
216
|
+
vi.restoreAllMocks();
|
|
217
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
function configFor(setupFiles = ["@fixture/setup-pkg/setup"], conditions?: string[]) {
|
|
221
|
+
return createVitestConfig({
|
|
222
|
+
tamaguiConfig: false,
|
|
223
|
+
dedupeReact: false,
|
|
224
|
+
setupFiles,
|
|
225
|
+
conditions,
|
|
226
|
+
}) as ViteUserConfig;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
it("uses the source export before dist exists", () => {
|
|
230
|
+
expect(configFor().test?.setupFiles).toEqual([source]);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it("keeps the source setup through Vitest's config resolver", async () => {
|
|
234
|
+
const { vitestConfig } = await resolveConfig(
|
|
235
|
+
{ root, config: false },
|
|
236
|
+
{ ...configFor(), plugins: [] },
|
|
237
|
+
);
|
|
238
|
+
expect(vitestConfig.setupFiles).toEqual([source]);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it("honors an explicit source opt-out", () => {
|
|
242
|
+
const built = path.join(packageDir, "dist/setup.mjs");
|
|
243
|
+
fs.mkdirSync(path.dirname(built), { recursive: true });
|
|
244
|
+
fs.writeFileSync(built, "export const ready = true;\n");
|
|
245
|
+
expect(configFor(undefined, ["test", "browser"]).test?.setupFiles).toEqual([built]);
|
|
246
|
+
expect(configFor().test?.setupFiles).toEqual([source]);
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it("leaves a missing dist target to Vitest when source is disabled", () => {
|
|
250
|
+
expect(configFor(undefined, ["test", "browser"]).test?.setupFiles).toEqual([
|
|
251
|
+
"@fixture/setup-pkg/setup",
|
|
252
|
+
]);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it("leaves file paths, URLs and unresolved packages to Vitest", () => {
|
|
256
|
+
const entries = ["./setup.ts", source, pathToFileURL(source).href, "@fixture/missing/setup"];
|
|
257
|
+
expect(configFor(entries).test?.setupFiles).toEqual(entries);
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
it("keeps setup ordering and the React pin first", () => {
|
|
261
|
+
const config = createVitestConfig({
|
|
262
|
+
tamaguiConfig: false,
|
|
263
|
+
setupFiles: ["./setup.ts", "@fixture/setup-pkg/setup", source],
|
|
264
|
+
}) as ViteUserConfig;
|
|
265
|
+
expect(config.test?.setupFiles).toEqual([
|
|
266
|
+
expect.stringMatching(/pin-react-require\.cjs$/),
|
|
267
|
+
"./setup.ts",
|
|
268
|
+
source,
|
|
269
|
+
source,
|
|
270
|
+
]);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it("reports an invalid export target instead of silently falling back", () => {
|
|
274
|
+
fs.writeFileSync(
|
|
275
|
+
path.join(packageDir, "package.json"),
|
|
276
|
+
JSON.stringify({
|
|
277
|
+
name: "@fixture/setup-pkg",
|
|
278
|
+
exports: { "./setup": { source: "../outside.ts" } },
|
|
279
|
+
}),
|
|
280
|
+
);
|
|
281
|
+
expect(() => configFor()).toThrow();
|
|
282
|
+
});
|
|
283
|
+
});
|
package/src/vitest.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import Module from "node:module";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
+
import { resolvePathSync } from "mlly";
|
|
5
6
|
import { tamaguiPlugin } from "@tamagui/vite-plugin";
|
|
6
7
|
import react from "@vitejs/plugin-react";
|
|
7
8
|
import type { UserConfig } from "vite";
|
|
@@ -13,6 +14,21 @@ const pinReactRequireSetup = path.resolve(
|
|
|
13
14
|
"../pin-react-require.cjs",
|
|
14
15
|
);
|
|
15
16
|
|
|
17
|
+
function resolveSetupFile(file: string, conditions: string[]): string {
|
|
18
|
+
if (file.startsWith(".") || path.isAbsolute(file) || /^[a-z][a-z\d+.-]*:/i.test(file))
|
|
19
|
+
return file;
|
|
20
|
+
try {
|
|
21
|
+
return resolvePathSync(file, {
|
|
22
|
+
url: pathToFileURL(path.join(process.cwd(), "vitest.config.js")),
|
|
23
|
+
conditions: [...conditions, "import"],
|
|
24
|
+
extensions: [],
|
|
25
|
+
});
|
|
26
|
+
} catch (error) {
|
|
27
|
+
if ((error as NodeJS.ErrnoException).code === "ERR_MODULE_NOT_FOUND") return file;
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
16
32
|
/**
|
|
17
33
|
* The coverage SonarQube reads (FZ-8866). With MPO_COVERAGE=1, CI's test-vitest
|
|
18
34
|
* measures every run as lcov, even a failing one. Each vitest process writes
|
|
@@ -289,10 +305,11 @@ export function createVitestConfig(options: CreateVitestConfigOptions = {}): Use
|
|
|
289
305
|
pinNodeReactRequire(reactDir, reactDomDir, schedulerDir);
|
|
290
306
|
}
|
|
291
307
|
|
|
308
|
+
const resolvedSetupFiles = setupFiles.map((file) => resolveSetupFile(file, conditions));
|
|
292
309
|
const testConfig: Record<string, unknown> = {
|
|
293
310
|
environment,
|
|
294
311
|
globals: true,
|
|
295
|
-
setupFiles: dedupeReact ? [pinReactRequireSetup, ...
|
|
312
|
+
setupFiles: dedupeReact ? [pinReactRequireSetup, ...resolvedSetupFiles] : resolvedSetupFiles,
|
|
296
313
|
testTimeout,
|
|
297
314
|
coverage: {
|
|
298
315
|
provider: "v8" as const,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { packageSubpathSourceAliases } from "@multiplatform.one/utils/dev";
|
|
4
|
+
|
|
5
|
+
export { packageSubpathSourceAliases, resolveExportSource } from "@multiplatform.one/utils/dev";
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* Every direct child of `public/` with a `package.json` `name` is treated as a
|
|
@@ -127,94 +130,6 @@ export function resolvePackageMainSource(pkgDir: string): string | undefined {
|
|
|
127
130
|
return candidates.find((c) => fs.existsSync(c));
|
|
128
131
|
}
|
|
129
132
|
|
|
130
|
-
type ExportTarget = string | null | ExportTarget[] | { [condition: string]: ExportTarget };
|
|
131
|
-
|
|
132
|
-
const webConditionOrder = ["import", "default", "require"];
|
|
133
|
-
const skippedConditions = new Set(["types", "react-native"]);
|
|
134
|
-
const tsSourcePattern = /\.(c|m)?tsx?$/;
|
|
135
|
-
|
|
136
|
-
function collectExportTargets(target: ExportTarget, out: string[]): void {
|
|
137
|
-
if (typeof target === "string") {
|
|
138
|
-
out.push(target);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if (!target) return;
|
|
142
|
-
if (Array.isArray(target)) {
|
|
143
|
-
for (const item of target) collectExportTargets(item, out);
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
if (typeof target.source === "string") out.push(target.source);
|
|
147
|
-
const keys = Object.keys(target).filter((k) => k !== "source" && !skippedConditions.has(k));
|
|
148
|
-
const ordered = [
|
|
149
|
-
...webConditionOrder.filter((k) => keys.includes(k)),
|
|
150
|
-
...keys.filter((k) => !webConditionOrder.includes(k)),
|
|
151
|
-
];
|
|
152
|
-
for (const key of ordered) collectExportTargets(target[key], out);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* The file a web build should compile for one `exports` entry: its `source`
|
|
157
|
-
* condition, else the first TypeScript file among its web conditions, else
|
|
158
|
-
* the first existing file (css, a prebuilt .mjs), so the package-name alias
|
|
159
|
-
* never swallows a subpath it cannot see.
|
|
160
|
-
*/
|
|
161
|
-
export function resolveExportSource(pkgDir: string, target: ExportTarget): string | undefined {
|
|
162
|
-
const candidates: string[] = [];
|
|
163
|
-
collectExportTargets(target, candidates);
|
|
164
|
-
const existing = candidates
|
|
165
|
-
.map((c) => path.resolve(pkgDir, c))
|
|
166
|
-
.filter((c) => !c.endsWith(".d.ts") && fs.existsSync(c) && fs.statSync(c).isFile());
|
|
167
|
-
return existing.find((c) => tsSourcePattern.test(c)) ?? existing[0];
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* The file a subpath declares when none of its targets is on disk yet, such
|
|
172
|
-
* as a prebuilt `./dist/...` asset in an unbuilt tree. Aliasing it keeps the
|
|
173
|
-
* bare package alias from rewriting the subpath into `src/index.ts/<subpath>`,
|
|
174
|
-
* so a missing build fails on the real path. Types-only subpaths get none.
|
|
175
|
-
*/
|
|
176
|
-
function declaredExportTarget(pkgDir: string, target: ExportTarget): string | undefined {
|
|
177
|
-
const candidates: string[] = [];
|
|
178
|
-
collectExportTargets(target, candidates);
|
|
179
|
-
const runtime = candidates.find((c) => !c.endsWith(".d.ts"));
|
|
180
|
-
return runtime ? path.resolve(pkgDir, runtime) : undefined;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Vite `resolve.alias` entries for one package's `exports` subpaths:
|
|
185
|
-
* `<name>/<subpath>` → its source file, and a `./dir/*` pattern → the directory.
|
|
186
|
-
*/
|
|
187
|
-
export function packageSubpathSourceAliases(
|
|
188
|
-
pkgName: string,
|
|
189
|
-
pkgDir: string,
|
|
190
|
-
exportsField: unknown,
|
|
191
|
-
): Record<string, string> {
|
|
192
|
-
const aliases: Record<string, string> = {};
|
|
193
|
-
if (!exportsField || typeof exportsField !== "object" || Array.isArray(exportsField)) {
|
|
194
|
-
return aliases;
|
|
195
|
-
}
|
|
196
|
-
for (const [key, target] of Object.entries(exportsField as Record<string, ExportTarget>)) {
|
|
197
|
-
if (key === "." || key === "./package.json" || !key.startsWith("./")) continue;
|
|
198
|
-
if (key.endsWith("/*")) {
|
|
199
|
-
const pattern = key.slice(2, -2);
|
|
200
|
-
if (pattern.includes("*")) continue;
|
|
201
|
-
const targets: string[] = [];
|
|
202
|
-
collectExportTargets(target, targets);
|
|
203
|
-
const dirTarget = targets.find((t) => t.endsWith("/*"));
|
|
204
|
-
if (!dirTarget) continue;
|
|
205
|
-
const dir = path.resolve(pkgDir, dirTarget.slice(0, -2));
|
|
206
|
-
if (fs.existsSync(dir) && fs.statSync(dir).isDirectory()) {
|
|
207
|
-
aliases[`${pkgName}/${pattern}`] = dir;
|
|
208
|
-
}
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
if (key.includes("*")) continue;
|
|
212
|
-
const file = resolveExportSource(pkgDir, target) ?? declaredExportTarget(pkgDir, target);
|
|
213
|
-
if (file) aliases[`${pkgName}/${key.slice(2)}`] = file;
|
|
214
|
-
}
|
|
215
|
-
return aliases;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
133
|
/**
|
|
219
134
|
* Vite `resolve.alias` entries: each public package name → its TypeScript
|
|
220
135
|
* main, plus every `exports` subpath → its own source file. For SPA / ad-hoc
|
package/types/vitest.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../src/vitest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../src/vitest.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAsFvC,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,CA4NtF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { packageSubpathSourceAliases, resolveExportSource } from "@multiplatform.one/utils/dev";
|
|
1
2
|
/**
|
|
2
3
|
* Every direct child of `public/` with a `package.json` `name` is treated as a
|
|
3
4
|
* publishable workspace package (same rule as Metro in `apps/storybook-expo`).
|
|
@@ -36,21 +37,6 @@ export declare function resolveWorkspaceNativeEntry(pkgRoot: string): string | u
|
|
|
36
37
|
* web-only side effects (fontsource @font-face CSS imports) never load.
|
|
37
38
|
*/
|
|
38
39
|
export declare function resolvePackageMainSource(pkgDir: string): string | undefined;
|
|
39
|
-
type ExportTarget = string | null | ExportTarget[] | {
|
|
40
|
-
[condition: string]: ExportTarget;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* The file a web build should compile for one `exports` entry: its `source`
|
|
44
|
-
* condition, else the first TypeScript file among its web conditions, else
|
|
45
|
-
* the first existing file (css, a prebuilt .mjs), so the package-name alias
|
|
46
|
-
* never swallows a subpath it cannot see.
|
|
47
|
-
*/
|
|
48
|
-
export declare function resolveExportSource(pkgDir: string, target: ExportTarget): string | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Vite `resolve.alias` entries for one package's `exports` subpaths:
|
|
51
|
-
* `<name>/<subpath>` → its source file, and a `./dir/*` pattern → the directory.
|
|
52
|
-
*/
|
|
53
|
-
export declare function packageSubpathSourceAliases(pkgName: string, pkgDir: string, exportsField: unknown): Record<string, string>;
|
|
54
40
|
/**
|
|
55
41
|
* Vite `resolve.alias` entries: each public package name → its TypeScript
|
|
56
42
|
* main, plus every `exports` subpath → its own source file. For SPA / ad-hoc
|
|
@@ -63,5 +49,4 @@ export declare function packageSubpathSourceAliases(pkgName: string, pkgDir: str
|
|
|
63
49
|
* longest first.
|
|
64
50
|
*/
|
|
65
51
|
export declare function publicPackageViteSourceAliases(workspaceRoot: string): Record<string, string>;
|
|
66
|
-
export {};
|
|
67
52
|
//# sourceMappingURL=workspacePublicPackages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspacePublicPackages.d.ts","sourceRoot":"","sources":["../src/workspacePublicPackages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspacePublicPackages.d.ts","sourceRoot":"","sources":["../src/workspacePublicPackages.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEhG;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAmBrF;AA6BD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMzE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgB/E;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgB3E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAuB5F"}
|