@multiplatform.one/config 9.17.0 → 10.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/design-lint.mjs +29 -6
- package/lib/index.js +4 -4
- package/lib/{storybook-BpaziEtP.js → storybook-BRZwQLAM.js} +150 -9
- package/lib/storybook.js +1 -1
- package/lib/{tamaguiWorkspacePaths-DR3dud79.js → tamaguiWorkspacePaths-BFMQNk1l.js} +8 -5
- package/lib/{vite-CgiDLR6V.js → vite-DaBjbGS0.js} +40 -52
- package/lib/vite.js +4 -4
- package/lib/{vitest-B2vcGrZM.js → vitest-NTT7k5jB.js} +97 -10
- package/lib/vitest.js +2 -2
- package/lib/{workspacePublicPackages-DN-1LPcH.js → workspacePublicPackages-z0fVhgGN.js} +121 -8
- package/lint.mjs +874 -52
- package/oxlint.mjs +26 -1
- package/package.json +6 -6
- package/press-lint.mjs +86 -5
- package/spec-registry.mjs +15 -0
- package/src/lint.spec.ts +696 -12
- package/src/movedDepAliases.spec.ts +73 -0
- package/src/movedDepAliases.ts +91 -0
- package/src/nativeBlockScoping.spec.ts +12 -14
- package/src/nativeOnlyDepStubs.spec.ts +178 -0
- package/src/nativeOnlyDepStubs.ts +215 -0
- package/src/noVoicelessText.rule.spec.ts +1 -1
- package/src/noVoicelessText.spec.ts +1 -1
- package/src/oxlint.spec.ts +5 -5
- package/src/phosphorNativeInk.spec.ts +17 -18
- package/src/phosphorTokenColor.spec.ts +35 -0
- package/src/phosphorTokenColor.ts +8 -5
- package/src/press-lint.spec.ts +64 -3
- package/src/react-native.config.cjs +9 -0
- package/src/shims/phosphorThemeInk.js +6 -1
- package/src/shims/svgTouchSound.web.js +23 -0
- package/src/singletonDepAliases.spec.ts +99 -14
- package/src/singletonDepAliases.ts +102 -7
- package/src/storybook.spec.ts +0 -3
- package/src/storybook.ts +17 -6
- package/src/vite.nativeEntries.spec.ts +21 -20
- package/src/vite.spec.ts +11 -20
- package/src/vite.ts +44 -68
- package/src/vitest.spec.ts +142 -4
- package/src/vitest.ts +106 -8
- package/types/movedDepAliases.d.ts +8 -0
- package/types/movedDepAliases.d.ts.map +1 -0
- package/types/nativeOnlyDepStubs.d.ts +41 -0
- package/types/nativeOnlyDepStubs.d.ts.map +1 -0
- package/types/phosphorTokenColor.d.ts.map +1 -1
- package/types/singletonDepAliases.d.ts +55 -3
- package/types/singletonDepAliases.d.ts.map +1 -1
- package/types/storybook.d.ts.map +1 -1
- package/types/vite.d.ts +10 -1
- package/types/vite.d.ts.map +1 -1
- package/types/vitest.d.ts +46 -1
- package/types/vitest.d.ts.map +1 -1
package/src/vitest.spec.ts
CHANGED
|
@@ -20,9 +20,16 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
20
20
|
import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
21
21
|
import type { ViteUserConfig } from "vitest/config";
|
|
22
22
|
import { createVitest, resolveConfig } from "vitest/node";
|
|
23
|
-
import { createServer, type ViteDevServer } from "vite";
|
|
23
|
+
import { createServer, resolveConfig as resolveViteConfig, type ViteDevServer } from "vite";
|
|
24
24
|
import { integrationConfig, integrationSpecs } from "./testTiers.js";
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
createVitestConfig,
|
|
27
|
+
pinnedPackages,
|
|
28
|
+
tamaguiEvaluationConditions,
|
|
29
|
+
tamaguiEvaluationExternals,
|
|
30
|
+
tamaguiExtractedCss,
|
|
31
|
+
type PinnedPackagesPlugin,
|
|
32
|
+
} from "./vitest.js";
|
|
26
33
|
|
|
27
34
|
const fixtureDir = path.resolve(
|
|
28
35
|
path.dirname(fileURLToPath(import.meta.url)),
|
|
@@ -92,7 +99,11 @@ describe("dedupeReact aliases", () => {
|
|
|
92
99
|
const componentsReactDom = path.join(componentsDir, "node_modules/react-dom");
|
|
93
100
|
|
|
94
101
|
function aliasMap() {
|
|
95
|
-
|
|
102
|
+
const plugins = (createVitestConfig({ tamaguiConfig: false }).plugins ?? []).flat() as Array<
|
|
103
|
+
PinnedPackagesPlugin | undefined
|
|
104
|
+
>;
|
|
105
|
+
const pinned = plugins.find((plugin) => plugin?.name === "mpo:pinned-packages");
|
|
106
|
+
return pinned?.api.pins ?? {};
|
|
96
107
|
}
|
|
97
108
|
|
|
98
109
|
it("binds react-dom/client and jsx-runtime to the same physical copies as the packages", () => {
|
|
@@ -155,6 +166,133 @@ describe("dedupeReact aliases", () => {
|
|
|
155
166
|
});
|
|
156
167
|
});
|
|
157
168
|
|
|
169
|
+
describe("Tamagui 3's config evaluation environment (FZ-10849)", () => {
|
|
170
|
+
let root: string;
|
|
171
|
+
|
|
172
|
+
beforeEach(() => {
|
|
173
|
+
root = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), "mpo-pins-"));
|
|
174
|
+
const pinnedReact = path.join(root, "pinned/react");
|
|
175
|
+
fs.mkdirSync(pinnedReact, { recursive: true });
|
|
176
|
+
fs.writeFileSync(
|
|
177
|
+
path.join(pinnedReact, "package.json"),
|
|
178
|
+
JSON.stringify({ name: "react", main: "index.js" }),
|
|
179
|
+
);
|
|
180
|
+
fs.writeFileSync(path.join(pinnedReact, "index.js"), "module.exports = {};\n");
|
|
181
|
+
fs.writeFileSync(path.join(pinnedReact, "jsx-runtime.js"), "module.exports = {};\n");
|
|
182
|
+
fs.writeFileSync(path.join(root, "entry.ts"), "");
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
afterEach(() => {
|
|
186
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it("pins react where specs render and leaves the evaluation environment to node", async () => {
|
|
190
|
+
const pinnedReact = path.join(root, "pinned/react");
|
|
191
|
+
const server = await createServer({
|
|
192
|
+
configFile: false,
|
|
193
|
+
logLevel: "silent",
|
|
194
|
+
root,
|
|
195
|
+
server: { middlewareMode: true },
|
|
196
|
+
plugins: [pinnedPackages({ react: pinnedReact })],
|
|
197
|
+
environments: { tamagui: { consumer: "server" } },
|
|
198
|
+
});
|
|
199
|
+
servers.push(server);
|
|
200
|
+
const importer = path.join(root, "entry.ts");
|
|
201
|
+
const inClient = await server.environments.client.pluginContainer.resolveId("react", importer);
|
|
202
|
+
const subpath = await server.environments.client.pluginContainer.resolveId(
|
|
203
|
+
"react/jsx-runtime",
|
|
204
|
+
importer,
|
|
205
|
+
);
|
|
206
|
+
const inEvaluation = await server.environments.tamagui.pluginContainer.resolveId(
|
|
207
|
+
"react",
|
|
208
|
+
importer,
|
|
209
|
+
);
|
|
210
|
+
expect(inClient?.id).toBe(path.join(pinnedReact, "index.js"));
|
|
211
|
+
expect(subpath?.id).toBe(path.join(pinnedReact, "jsx-runtime.js"));
|
|
212
|
+
expect(inEvaluation?.id ?? "").not.toContain(pinnedReact);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it("gives the evaluation environment back the externals vitest takes from it", async () => {
|
|
216
|
+
const config = await resolveViteConfig(
|
|
217
|
+
{
|
|
218
|
+
configFile: false,
|
|
219
|
+
logLevel: "silent",
|
|
220
|
+
root,
|
|
221
|
+
plugins: [
|
|
222
|
+
{
|
|
223
|
+
name: "tamagui-like",
|
|
224
|
+
config: () => ({ environments: { tamagui: { resolve: { noExternal: ["tamagui"] } } } }),
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: "vitest-like",
|
|
228
|
+
configEnvironment: {
|
|
229
|
+
order: "post",
|
|
230
|
+
handler(_name, environment) {
|
|
231
|
+
environment.resolve ??= {};
|
|
232
|
+
environment.resolve.noExternal = true;
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
tamaguiEvaluationExternals(),
|
|
237
|
+
],
|
|
238
|
+
},
|
|
239
|
+
"serve",
|
|
240
|
+
);
|
|
241
|
+
expect(config.environments.tamagui.resolve.noExternal).toEqual(["tamagui"]);
|
|
242
|
+
expect(config.environments.client.resolve.noExternal).toBe(true);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it("resolves the evaluation environment with the specs' conditions beside the plugin's", async () => {
|
|
246
|
+
const config = await resolveViteConfig(
|
|
247
|
+
{
|
|
248
|
+
configFile: false,
|
|
249
|
+
logLevel: "silent",
|
|
250
|
+
root,
|
|
251
|
+
plugins: [
|
|
252
|
+
{
|
|
253
|
+
name: "tamagui-like",
|
|
254
|
+
config: () => ({
|
|
255
|
+
environments: { tamagui: { resolve: { conditions: ["tamagui-compiler"] } } },
|
|
256
|
+
}),
|
|
257
|
+
},
|
|
258
|
+
tamaguiEvaluationConditions(["source", "test"]),
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
"serve",
|
|
262
|
+
);
|
|
263
|
+
expect(config.environments.tamagui.resolve.conditions).toEqual(
|
|
264
|
+
expect.arrayContaining(["tamagui-compiler", "source", "test"]),
|
|
265
|
+
);
|
|
266
|
+
expect(config.environments.client.resolve.conditions).not.toContain("source");
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it("puts the restore beside the tamagui plugin and the pins beside the aliases", () => {
|
|
270
|
+
const names = (
|
|
271
|
+
(
|
|
272
|
+
(createVitestConfig({ tamaguiConfig: "./tests/tamagui.config.ts" }).plugins ??
|
|
273
|
+
[]) as unknown[]
|
|
274
|
+
).flat(Infinity) as Array<{ name?: string } | undefined>
|
|
275
|
+
).map((plugin) => plugin?.name);
|
|
276
|
+
expect(names).toContain("mpo:tamagui-evaluation-externals");
|
|
277
|
+
expect(names).toContain("mpo:pinned-packages");
|
|
278
|
+
const aliases = createVitestConfig({ tamaguiConfig: false }).resolve?.alias as Record<
|
|
279
|
+
string,
|
|
280
|
+
string
|
|
281
|
+
>;
|
|
282
|
+
expect(Object.keys(aliases)).not.toContain("react");
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
it("loads the compiler's extracted stylesheets only where the compiler runs", () => {
|
|
286
|
+
const cssOf = (tamaguiConfig: string | false) =>
|
|
287
|
+
(createVitestConfig({ tamaguiConfig, dedupeReact: false }) as ViteUserConfig).test?.css;
|
|
288
|
+
expect(cssOf("./tests/tamagui.config.ts")).toEqual({ include: [tamaguiExtractedCss] });
|
|
289
|
+
expect(cssOf(false)).toBeUndefined();
|
|
290
|
+
expect(tamaguiExtractedCss.test("/repo/src/Button.tsx.tamagui.css")).toBe(true);
|
|
291
|
+
expect(tamaguiExtractedCss.test("/repo/src/Button.tsx.tamagui.css?direct")).toBe(true);
|
|
292
|
+
expect(tamaguiExtractedCss.test("/repo/src/theme.css")).toBe(false);
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
|
|
158
296
|
describe("coverage for SonarQube (FZ-8866)", () => {
|
|
159
297
|
const coverageOf = () =>
|
|
160
298
|
(createVitestConfig({ tamaguiConfig: false, dedupeReact: false }) as ViteUserConfig).test
|
|
@@ -336,7 +474,7 @@ describe("test tiers by file name (FZ-10556)", () => {
|
|
|
336
474
|
let root: string;
|
|
337
475
|
|
|
338
476
|
beforeEach(() => {
|
|
339
|
-
root = fs.mkdtempSync(path.join(os.tmpdir(), "mpo-test-tiers-"));
|
|
477
|
+
root = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), "mpo-test-tiers-"));
|
|
340
478
|
for (const file of files) {
|
|
341
479
|
fs.mkdirSync(path.dirname(path.join(root, file)), { recursive: true });
|
|
342
480
|
fs.writeFileSync(path.join(root, file), "");
|
package/src/vitest.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
5
5
|
import { resolvePathSync } from "mlly";
|
|
6
6
|
import { tamaguiPlugin } from "@tamagui/vite-plugin";
|
|
7
7
|
import react from "@vitejs/plugin-react";
|
|
8
|
-
import type { UserConfig } from "vite";
|
|
8
|
+
import type { Plugin, UserConfig } from "vite";
|
|
9
9
|
import { configDefaults } from "vitest/config";
|
|
10
10
|
import { phosphorBarrelBundlePlugin, phosphorTokenColorPlugin } from "./phosphorTokenColor.js";
|
|
11
11
|
import { ensureTamaguiWorkspacePaths } from "./tamaguiWorkspacePaths.js";
|
|
@@ -104,6 +104,96 @@ function pinNodeReactRequire(reactDir: string, reactDomDir: string, schedulerDir
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
/**
|
|
108
|
+
* The Vite environment Tamagui 3's vite plugin evaluates the tamagui config in
|
|
109
|
+
* (`TAMAGUI_EVALUATION_ENVIRONMENT` in @tamagui/vite-plugin's loadTamagui.ts,
|
|
110
|
+
* not exported). It inlines only the Tamagui packages it has to and hands every
|
|
111
|
+
* other bare import, react above all, to node.
|
|
112
|
+
*/
|
|
113
|
+
const tamaguiEvaluationEnvironment = "tamagui";
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Vitest 4 sets `resolve.noExternal = true` on every Vite environment but its
|
|
117
|
+
* own runner's, Tamagui's evaluation environment included, so react's CJS
|
|
118
|
+
* entry gets inlined there and the run dies before collecting a spec with
|
|
119
|
+
* `module is not defined`. Put the plugin's own list back once vitest has had
|
|
120
|
+
* its say. The client and ssr environments vitest runs specs in keep vitest's.
|
|
121
|
+
*/
|
|
122
|
+
export function tamaguiEvaluationExternals(): Plugin {
|
|
123
|
+
let noExternal: unknown;
|
|
124
|
+
return {
|
|
125
|
+
name: "mpo:tamagui-evaluation-externals",
|
|
126
|
+
configEnvironment(name, config) {
|
|
127
|
+
if (name === tamaguiEvaluationEnvironment) noExternal = config.resolve?.noExternal;
|
|
128
|
+
},
|
|
129
|
+
configResolved(config) {
|
|
130
|
+
const environment = config.environments[tamaguiEvaluationEnvironment];
|
|
131
|
+
if (!environment || noExternal === undefined) return;
|
|
132
|
+
environment.resolve.noExternal = noExternal as typeof environment.resolve.noExternal;
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Tamagui 3 evaluates a package's tamagui config in its own environment, which
|
|
139
|
+
* resolves with Vite's default client conditions plus `tamagui-compiler` and
|
|
140
|
+
* none of MPO's. A config that imports a workspace package
|
|
141
|
+
* (`createDefaultThemeConfig` from @multiplatform.one/theme) then reaches for
|
|
142
|
+
* that package's unbuilt `dist/` and the run dies at startup with
|
|
143
|
+
* `Failed to resolve entry for package`. The plugin merges a user's
|
|
144
|
+
* `environments.tamagui` over its own, so this hands that environment the
|
|
145
|
+
* conditions the specs resolve with, `source` first among them.
|
|
146
|
+
*/
|
|
147
|
+
export function tamaguiEvaluationConditions(conditions: string[]): Plugin {
|
|
148
|
+
return {
|
|
149
|
+
name: "mpo:tamagui-evaluation-conditions",
|
|
150
|
+
config() {
|
|
151
|
+
return { environments: { [tamaguiEvaluationEnvironment]: { resolve: { conditions } } } };
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The virtual stylesheet Tamagui 3's compiler writes each module's extracted
|
|
158
|
+
* atomic rules to (`virtualExt` in @tamagui/vite-plugin's plugin.ts). Vitest
|
|
159
|
+
* drops every CSS module its `css.include` doesn't name, so without this an
|
|
160
|
+
* element the compiler flattened carries hashed classes with no rule behind
|
|
161
|
+
* them, while a runtime-styled sibling's rules sit in `#_tamagui-styles`.
|
|
162
|
+
* Naming it puts both kinds of rule in `document.styleSheets`, where
|
|
163
|
+
* `atomicStyle()` in @multiplatform.one/test-utils reads them.
|
|
164
|
+
*/
|
|
165
|
+
export const tamaguiExtractedCss = /\.tamagui\.css(?:\?|$)/;
|
|
166
|
+
|
|
167
|
+
export type PinnedPackagesPlugin = Plugin & { api: { pins: Record<string, string> } };
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* MPO-37's one-physical-copy pins as a resolver rather than `resolve.alias`.
|
|
171
|
+
* An alias applies in every environment, and in Tamagui's evaluation
|
|
172
|
+
* environment it turns `react` into a file path, which that environment
|
|
173
|
+
* inlines instead of handing to node. The pins only matter where specs render,
|
|
174
|
+
* so that environment resolves react the way node does.
|
|
175
|
+
*
|
|
176
|
+
* Matching is the alias's: a pin applies to its name and to any subpath under
|
|
177
|
+
* it, so `react/jsx-runtime` lands in the pinned react.
|
|
178
|
+
*/
|
|
179
|
+
export function pinnedPackages(pins: Record<string, string>): PinnedPackagesPlugin {
|
|
180
|
+
const names = Object.keys(pins).sort((a, b) => b.length - a.length);
|
|
181
|
+
return {
|
|
182
|
+
name: "mpo:pinned-packages",
|
|
183
|
+
enforce: "pre",
|
|
184
|
+
api: { pins },
|
|
185
|
+
async resolveId(source, importer, options) {
|
|
186
|
+
if (this.environment?.name === tamaguiEvaluationEnvironment) return null;
|
|
187
|
+
const name = names.find((pin) => source === pin || source.startsWith(`${pin}/`));
|
|
188
|
+
if (!name) return null;
|
|
189
|
+
return this.resolve(pins[name] + source.slice(name.length), importer, {
|
|
190
|
+
...options,
|
|
191
|
+
skipSelf: true,
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
107
197
|
export interface CreateVitestConfigOptions {
|
|
108
198
|
/**
|
|
109
199
|
* Path to the Tamagui config file for test environments.
|
|
@@ -263,6 +353,8 @@ export function createVitestConfig(options: CreateVitestConfigOptions = {}): Use
|
|
|
263
353
|
components: ["tamagui"],
|
|
264
354
|
config: tamaguiConfig,
|
|
265
355
|
} as any),
|
|
356
|
+
tamaguiEvaluationExternals(),
|
|
357
|
+
tamaguiEvaluationConditions(conditions),
|
|
266
358
|
);
|
|
267
359
|
}
|
|
268
360
|
|
|
@@ -308,14 +400,18 @@ export function createVitestConfig(options: CreateVitestConfigOptions = {}): Use
|
|
|
308
400
|
};
|
|
309
401
|
const reactDir = onePhysicalCopy("react");
|
|
310
402
|
const reactDomDir = onePhysicalCopy("react-dom");
|
|
311
|
-
resolveAliases.react = reactDir;
|
|
312
|
-
resolveAliases["react-dom"] = reactDomDir;
|
|
313
|
-
resolveAliases["react-dom/client"] = path.join(reactDomDir, "client");
|
|
314
|
-
resolveAliases["react-dom/server"] = path.join(reactDomDir, "server");
|
|
315
|
-
resolveAliases["react/jsx-runtime"] = path.join(reactDir, "jsx-runtime");
|
|
316
|
-
resolveAliases["react/jsx-dev-runtime"] = path.join(reactDir, "jsx-dev-runtime");
|
|
317
403
|
const schedulerDir = onePhysicalCopy("scheduler");
|
|
318
|
-
|
|
404
|
+
plugins.push(
|
|
405
|
+
pinnedPackages({
|
|
406
|
+
react: reactDir,
|
|
407
|
+
"react-dom": reactDomDir,
|
|
408
|
+
"react-dom/client": path.join(reactDomDir, "client"),
|
|
409
|
+
"react-dom/server": path.join(reactDomDir, "server"),
|
|
410
|
+
"react/jsx-runtime": path.join(reactDir, "jsx-runtime"),
|
|
411
|
+
"react/jsx-dev-runtime": path.join(reactDir, "jsx-dev-runtime"),
|
|
412
|
+
scheduler: schedulerDir,
|
|
413
|
+
}),
|
|
414
|
+
);
|
|
319
415
|
process.env.MPO_VITEST_REACT = reactDir;
|
|
320
416
|
process.env.MPO_VITEST_REACT_DOM = reactDomDir;
|
|
321
417
|
process.env.MPO_VITEST_SCHEDULER = schedulerDir;
|
|
@@ -326,6 +422,7 @@ export function createVitestConfig(options: CreateVitestConfigOptions = {}): Use
|
|
|
326
422
|
const testConfig: Record<string, unknown> = {
|
|
327
423
|
environment,
|
|
328
424
|
globals: true,
|
|
425
|
+
env: { IS_STATIC: "" },
|
|
329
426
|
setupFiles: dedupeReact ? [pinReactRequireSetup, ...resolvedSetupFiles] : resolvedSetupFiles,
|
|
330
427
|
testTimeout: positiveIntEnv("VITEST_TEST_TIMEOUT") ?? testTimeout,
|
|
331
428
|
...(positiveIntEnv("VITEST_MAX_WORKERS")
|
|
@@ -383,6 +480,7 @@ export function createVitestConfig(options: CreateVitestConfigOptions = {}): Use
|
|
|
383
480
|
if (include) testConfig.include = include;
|
|
384
481
|
testConfig.exclude = [...(exclude ?? configDefaults.exclude), ...integrationSpecs];
|
|
385
482
|
if (passWithNoTests) testConfig.passWithNoTests = true;
|
|
483
|
+
if (tamaguiConfig !== false) testConfig.css = { include: [tamaguiExtractedCss] };
|
|
386
484
|
|
|
387
485
|
return {
|
|
388
486
|
plugins,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vite `resolve.alias` entries for modules that moved out from under a
|
|
3
|
+
* publisher's import.
|
|
4
|
+
*
|
|
5
|
+
* @param root Directory whose `node_modules` the packages resolve from.
|
|
6
|
+
*/
|
|
7
|
+
export declare function movedDepAliases(root?: string): Record<string, string>;
|
|
8
|
+
//# sourceMappingURL=movedDepAliases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"movedDepAliases.d.ts","sourceRoot":"","sources":["../src/movedDepAliases.ts"],"names":[],"mappings":"AAwDA;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,MAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWpF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
export interface NativeOnlyDepStub {
|
|
3
|
+
/** Path fragment that proves an importer belongs to the owning package. */
|
|
4
|
+
marker: string;
|
|
5
|
+
/** Every spelling of the specifier a bundler can hand the resolver. */
|
|
6
|
+
specifiers: readonly string[];
|
|
7
|
+
/** Absolute path of the replacement module. */
|
|
8
|
+
stub: string;
|
|
9
|
+
}
|
|
10
|
+
/** Resolves a package's native-only module to its web stub, or null. */
|
|
11
|
+
export type NativeOnlyDepResolver = (id: string, importer?: string) => string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Entries whose breakage is real in this tree, with their stub resolved.
|
|
14
|
+
*
|
|
15
|
+
* @param root Directory whose `node_modules` the packages resolve from.
|
|
16
|
+
*/
|
|
17
|
+
export declare function nativeOnlyDepStubs(root?: string): NativeOnlyDepStub[];
|
|
18
|
+
/**
|
|
19
|
+
* The resolver behind both plugins below, or undefined when nothing in this
|
|
20
|
+
* tree measures as broken.
|
|
21
|
+
*/
|
|
22
|
+
export declare function nativeOnlyDepResolver(root?: string): NativeOnlyDepResolver | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Vite plugin for the transform pipeline (`vite build`, `storybook build`).
|
|
25
|
+
*
|
|
26
|
+
* `enforce: "pre"` is load-bearing: a normal-order plugin resolves after
|
|
27
|
+
* `vite:resolve`, which has already turned the relative specifier into a real
|
|
28
|
+
* file by then.
|
|
29
|
+
*/
|
|
30
|
+
export declare function nativeOnlyDepStubPlugin(root?: string): Plugin | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The same resolver for the dev dep-optimizer, which runs its own rolldown
|
|
33
|
+
* build that sees neither user plugins nor `resolve.alias` for a relative
|
|
34
|
+
* specifier — only `optimizeDeps.rolldownOptions.plugins`. Carries no vite-only
|
|
35
|
+
* fields, since rolldown receives this object directly.
|
|
36
|
+
*/
|
|
37
|
+
export declare function nativeOnlyDepStubOptimizerPlugin(root?: string): {
|
|
38
|
+
name: string;
|
|
39
|
+
resolveId: NativeOnlyDepResolver;
|
|
40
|
+
} | undefined;
|
|
41
|
+
//# sourceMappingURL=nativeOnlyDepStubs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeOnlyDepStubs.d.ts","sourceRoot":"","sources":["../src/nativeOnlyDepStubs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AA2DnC,MAAM,WAAW,iBAAiB;IAChC,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wEAAwE;AACxE,MAAM,MAAM,qBAAqB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;AAErF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,GAAE,MAAsB,GAAG,iBAAiB,EAAE,CAqBpF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,GAAE,MAAsB,GAC3B,qBAAqB,GAAG,SAAS,CAWnC;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,GAAE,MAAsB,GAAG,MAAM,GAAG,SAAS,CAUxF;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,GAAE,MAAsB,GAC3B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,qBAAqB,CAAA;CAAE,GAAG,SAAS,CAIhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phosphorTokenColor.d.ts","sourceRoot":"","sources":["../src/phosphorTokenColor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"phosphorTokenColor.d.ts","sourceRoot":"","sources":["../src/phosphorTokenColor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAqFnC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAgBjD;AAkDD;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAkBnD"}
|
|
@@ -2,13 +2,65 @@
|
|
|
2
2
|
* Vite `resolve.alias` entries pinning each context singleton to one directory.
|
|
3
3
|
*
|
|
4
4
|
* Alias keys match the whole specifier or a `key + "/"` prefix, so subpath
|
|
5
|
-
* imports follow the same copy instead of resolving independently.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* imports follow the same copy instead of resolving independently. That holds
|
|
6
|
+
* only while every subpath is a real file under the package directory; a
|
|
7
|
+
* package whose `exports` map REMAPS one is pinned by
|
|
8
|
+
* `singletonResolvePlugin` instead, because the prefix would rewrite the
|
|
9
|
+
* specifier to a path that does not exist. Entries are omitted when the
|
|
10
|
+
* package is not installed, so a consumer that does not use cookies is
|
|
11
|
+
* unaffected.
|
|
8
12
|
*
|
|
9
13
|
* @param root Directory whose `node_modules` the packages resolve from.
|
|
10
14
|
*/
|
|
11
15
|
export declare function singletonDepAliases(root?: string): Record<string, string>;
|
|
16
|
+
/** One installed context singleton, and how it has to be pinned. */
|
|
17
|
+
export interface SingletonPin {
|
|
18
|
+
name: string;
|
|
19
|
+
dir: string;
|
|
20
|
+
/** Its `exports` map remaps a subpath, so a directory alias cannot pin it. */
|
|
21
|
+
exportsMapped: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Every installed context singleton with its pinned directory.
|
|
25
|
+
*
|
|
26
|
+
* `exportsMapped` is measured rather than listed: a subpath key whose literal
|
|
27
|
+
* path does not exist under the package is one only the `exports` map can
|
|
28
|
+
* resolve. Measured on the installed tree at Tamagui 3.2.3, `@tamagui/core`
|
|
29
|
+
* and `@tamagui/web` each remap `./theme-update`, `./dom` and
|
|
30
|
+
* `./static-resolve`, and `react-cookie` and the three tanstack packages remap
|
|
31
|
+
* nothing. So a tanstack upgrade that adds a remapped subpath moves itself to
|
|
32
|
+
* the plugin instead of breaking a build.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveSingletons(root?: string): SingletonPin[];
|
|
35
|
+
/**
|
|
36
|
+
* Pins the singletons a directory alias cannot reach.
|
|
37
|
+
*
|
|
38
|
+
* `tamagui`'s own index imports `./theme-update.mjs`, which imports
|
|
39
|
+
* `@tamagui/core/theme-update`, which imports `@tamagui/web/theme-update`, so
|
|
40
|
+
* every import of `tamagui` anywhere walks that chain. Under a directory alias
|
|
41
|
+
* the prefix match rewrites it to `<pkgDir>/theme-update`, which is not a file,
|
|
42
|
+
* and `apps/one`'s production build dies with
|
|
43
|
+
* `[UNLOADABLE_DEPENDENCY] Could not load @tamagui/core/theme-update`. The dev
|
|
44
|
+
* server and vitest pre-bundle bare imports by package NAME and never see it,
|
|
45
|
+
* which is why 19,236 specs pass against a build that cannot be made.
|
|
46
|
+
*
|
|
47
|
+
* Re-resolving ANCHORED at the pinned package's own `package.json` is what
|
|
48
|
+
* keeps both halves: the exports map runs, so the environment's own conditions
|
|
49
|
+
* pick `.mjs` on web and `.native.js` on native, and the copy is the pinned one
|
|
50
|
+
* because that is where the resolution starts. A static target cannot do this,
|
|
51
|
+
* since the web and native files differ and this alias set is shared by both.
|
|
52
|
+
*
|
|
53
|
+
* @param root Directory whose `node_modules` the packages resolve from.
|
|
54
|
+
*/
|
|
55
|
+
export declare function singletonResolvePlugin(root?: string): {
|
|
56
|
+
name: string;
|
|
57
|
+
enforce: "pre";
|
|
58
|
+
resolveId: (this: {
|
|
59
|
+
resolve: (source: string, importer?: string, options?: Record<string, unknown>) => Promise<{
|
|
60
|
+
id: string;
|
|
61
|
+
} | null>;
|
|
62
|
+
}, source: string, importer: string | undefined, options: Record<string, unknown>) => Promise<string | null>;
|
|
63
|
+
};
|
|
12
64
|
/**
|
|
13
65
|
* Merges `base` with the singleton pins and orders the result for Vite.
|
|
14
66
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"singletonDepAliases.d.ts","sourceRoot":"","sources":["../src/singletonDepAliases.ts"],"names":[],"mappings":"AA6GA
|
|
1
|
+
{"version":3,"file":"singletonDepAliases.d.ts","sourceRoot":"","sources":["../src/singletonDepAliases.ts"],"names":[],"mappings":"AA6GA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,GAAE,MAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxF;AAED,oEAAoE;AACpE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,MAAsB,GAAG,YAAY,EAAE,CAQ9E;AAkBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,GAAE,MAAsB,GAAG;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,KAAK,CAAC;IACf,SAAS,EAAE,CACT,IAAI,EAAE;QACJ,OAAO,EAAE,CACP,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,OAAO,CAAC;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC,CAAC;KACrC,EACD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC7B,CAaA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,IAAI,GAAE,MAAsB,EAC5B,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACrC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxB"}
|
package/types/storybook.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storybook.d.ts","sourceRoot":"","sources":["../src/storybook.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAU,UAAU,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"storybook.d.ts","sourceRoot":"","sources":["../src/storybook.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAU,UAAU,EAAE,MAAM,MAAM,CAAC;AAS/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,CA8LZ"}
|
package/types/vite.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UserConfig } from "vite";
|
|
1
|
+
import type { Plugin, UserConfig } from "vite";
|
|
2
2
|
export interface CreateViteConfigOptions {
|
|
3
3
|
/**
|
|
4
4
|
* Absolute path to the project root (directory containing .env files).
|
|
@@ -168,6 +168,15 @@ export declare function createViteConfig(options?: CreateViteConfigOptions): Use
|
|
|
168
168
|
export { discoverPublicPackageRoots, publicPackageViteSourceAliases, resolveWorkspaceNativeEntry, staleNativeDistSource, } from "./workspacePublicPackages.js";
|
|
169
169
|
export { publicConfigPlugin, readPublicConfigKeys, type PublicConfigPluginOptions, } from "./publicConfig.js";
|
|
170
170
|
export { phosphorTokenColorPlugin } from "./phosphorTokenColor.js";
|
|
171
|
+
/**
|
|
172
|
+
* A rolldown plugin for the native bundle only. one 2.x hands every vite
|
|
173
|
+
* plugin that carries `api.vxrnNative` to vxrn's native rolldown pipeline, in
|
|
174
|
+
* dev and in the native export; the vite plugin is a hookless shell under its
|
|
175
|
+
* own name, so web and SSR never run or list the native plugin.
|
|
176
|
+
*/
|
|
177
|
+
export declare function nativeOnlyPlugin<T extends {
|
|
178
|
+
name: string;
|
|
179
|
+
}>(plugin: T): Plugin;
|
|
171
180
|
export declare const phosphorNativeIconBaseId = "#mpo/phosphor-native-icon-base";
|
|
172
181
|
/** phosphor-react-native's own `lib` (its `IconContext`), for the theme-ink shim (FZ-8996). */
|
|
173
182
|
export declare const phosphorNativeIconLibId = "#mpo/phosphor-native-icon-lib";
|
package/types/vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAI/C,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE5B;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;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,CAA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,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAE9E;AA6cD,eAAO,MAAM,wBAAwB,mCAAmC,CAAC;AACzE,+FAA+F;AAC/F,eAAO,MAAM,uBAAuB,kCAAkC,CAAC;AAEvE;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,GAClB,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAiB3D"}
|
package/types/vitest.d.ts
CHANGED
|
@@ -1,4 +1,49 @@
|
|
|
1
|
-
import type { UserConfig } from "vite";
|
|
1
|
+
import type { Plugin, UserConfig } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* Vitest 4 sets `resolve.noExternal = true` on every Vite environment but its
|
|
4
|
+
* own runner's, Tamagui's evaluation environment included, so react's CJS
|
|
5
|
+
* entry gets inlined there and the run dies before collecting a spec with
|
|
6
|
+
* `module is not defined`. Put the plugin's own list back once vitest has had
|
|
7
|
+
* its say. The client and ssr environments vitest runs specs in keep vitest's.
|
|
8
|
+
*/
|
|
9
|
+
export declare function tamaguiEvaluationExternals(): Plugin;
|
|
10
|
+
/**
|
|
11
|
+
* Tamagui 3 evaluates a package's tamagui config in its own environment, which
|
|
12
|
+
* resolves with Vite's default client conditions plus `tamagui-compiler` and
|
|
13
|
+
* none of MPO's. A config that imports a workspace package
|
|
14
|
+
* (`createDefaultThemeConfig` from @multiplatform.one/theme) then reaches for
|
|
15
|
+
* that package's unbuilt `dist/` and the run dies at startup with
|
|
16
|
+
* `Failed to resolve entry for package`. The plugin merges a user's
|
|
17
|
+
* `environments.tamagui` over its own, so this hands that environment the
|
|
18
|
+
* conditions the specs resolve with, `source` first among them.
|
|
19
|
+
*/
|
|
20
|
+
export declare function tamaguiEvaluationConditions(conditions: string[]): Plugin;
|
|
21
|
+
/**
|
|
22
|
+
* The virtual stylesheet Tamagui 3's compiler writes each module's extracted
|
|
23
|
+
* atomic rules to (`virtualExt` in @tamagui/vite-plugin's plugin.ts). Vitest
|
|
24
|
+
* drops every CSS module its `css.include` doesn't name, so without this an
|
|
25
|
+
* element the compiler flattened carries hashed classes with no rule behind
|
|
26
|
+
* them, while a runtime-styled sibling's rules sit in `#_tamagui-styles`.
|
|
27
|
+
* Naming it puts both kinds of rule in `document.styleSheets`, where
|
|
28
|
+
* `atomicStyle()` in @multiplatform.one/test-utils reads them.
|
|
29
|
+
*/
|
|
30
|
+
export declare const tamaguiExtractedCss: RegExp;
|
|
31
|
+
export type PinnedPackagesPlugin = Plugin & {
|
|
32
|
+
api: {
|
|
33
|
+
pins: Record<string, string>;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* MPO-37's one-physical-copy pins as a resolver rather than `resolve.alias`.
|
|
38
|
+
* An alias applies in every environment, and in Tamagui's evaluation
|
|
39
|
+
* environment it turns `react` into a file path, which that environment
|
|
40
|
+
* inlines instead of handing to node. The pins only matter where specs render,
|
|
41
|
+
* so that environment resolves react the way node does.
|
|
42
|
+
*
|
|
43
|
+
* Matching is the alias's: a pin applies to its name and to any subpath under
|
|
44
|
+
* it, so `react/jsx-runtime` lands in the pinned react.
|
|
45
|
+
*/
|
|
46
|
+
export declare function pinnedPackages(pins: Record<string, string>): PinnedPackagesPlugin;
|
|
2
47
|
export interface CreateVitestConfigOptions {
|
|
3
48
|
/**
|
|
4
49
|
* Path to the Tamagui config file for test environments.
|
package/types/vitest.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../src/vitest.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../src/vitest.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,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