@multiplatform.one/config 7.34.0 → 7.34.2
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/{vite-D0MOGcSZ.js → vite-n3XSaftn.js} +42 -0
- package/lib/vite.js +1 -1
- package/package.json +4 -3
- package/src/vite.spec.ts +28 -0
- package/src/vite.ts +42 -0
- package/types/vite.d.ts.map +1 -1
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createViteConfig } from "./vite-
|
|
1
|
+
import { t as createViteConfig } from "./vite-n3XSaftn.js";
|
|
2
2
|
import { i as phosphorTokenColorPlugin, n as tamaguiWorkspacePathsFile, t as ensureTamaguiWorkspacePaths } from "./tamaguiWorkspacePaths-B6aRC2BU.js";
|
|
3
3
|
import { t as createStorybookViteConfig } from "./storybook-Dxwh_fl2.js";
|
|
4
4
|
import { createVitestConfig } from "./vitest.js";
|
|
@@ -244,6 +244,7 @@ function createViteConfig(options = {}) {
|
|
|
244
244
|
registerNativePhosphorIcons();
|
|
245
245
|
if (nativeFixes?.protoShadow !== false) registerNativeProtoShadowFix();
|
|
246
246
|
if (nativeFixes?.web3Stub !== false) registerNativeWeb3Stub();
|
|
247
|
+
registerNativeCommunityFlowStrip();
|
|
247
248
|
if (ssrCjsExternal !== false) vitePlugins.push(ssrCjsExternalFixPlugin([...DEFAULT_SSR_CJS_EXTERNAL, ...ssrCjsExternal ?? []]));
|
|
248
249
|
}
|
|
249
250
|
if (tamagui) {
|
|
@@ -678,6 +679,47 @@ function registerNativeProtoShadowFix() {
|
|
|
678
679
|
});
|
|
679
680
|
}
|
|
680
681
|
/**
|
|
682
|
+
* Flow-strip `@react-native-community/*` sources on NATIVE.
|
|
683
|
+
*
|
|
684
|
+
* vxrn's built-in flow-strip only matches `node_modules/(react-native|
|
|
685
|
+
* @react-native)/`, and the `@react-native` alternative needs a slash next, so
|
|
686
|
+
* `@react-native-community/datetimepicker` (whose package entry is its
|
|
687
|
+
* Flow-typed `src/`) is never stripped and rolldown dies with
|
|
688
|
+
* "[PARSE_ERROR] Flow is not supported". Of the optional native peers the
|
|
689
|
+
* catalog packages declare, datetimepicker is the one that ships Flow. Same
|
|
690
|
+
* mechanism as vxrn's own plugin (fast-flow-transform), scoped to the
|
|
691
|
+
* community org, so a consumer app needs no plugin of its own (FZ-7357).
|
|
692
|
+
*/
|
|
693
|
+
function registerNativeCommunityFlowStrip() {
|
|
694
|
+
const g = globalThis;
|
|
695
|
+
const name = "vxrn-community-flow-strip";
|
|
696
|
+
g.__vxrnAddNativePlugins = g.__vxrnAddNativePlugins ?? [];
|
|
697
|
+
if (g.__vxrnAddNativePlugins.some((p) => p?.name === name)) return;
|
|
698
|
+
g.__vxrnAddNativePlugins.push({
|
|
699
|
+
name,
|
|
700
|
+
async transform(code, id) {
|
|
701
|
+
if (!/node_modules[\\/]@react-native-community[\\/].*\.jsx?$/.test(id)) return null;
|
|
702
|
+
try {
|
|
703
|
+
const { default: flowTransform } = await import("fast-flow-transform");
|
|
704
|
+
const result = await flowTransform({
|
|
705
|
+
filename: id,
|
|
706
|
+
source: code,
|
|
707
|
+
sourcemap: true,
|
|
708
|
+
dialect: "flow",
|
|
709
|
+
format: "pretty"
|
|
710
|
+
});
|
|
711
|
+
return {
|
|
712
|
+
code: result.code,
|
|
713
|
+
map: result.map
|
|
714
|
+
};
|
|
715
|
+
} catch (err) {
|
|
716
|
+
process.stderr.write(`[${name}] ${id}: ${err.message}\n`);
|
|
717
|
+
return null;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
681
723
|
* Redirect the OPTIONAL `@multiplatform.one/web3` native import to a no-op
|
|
682
724
|
* shim on NATIVE when the package is not installed (see the nativeFixes
|
|
683
725
|
* option docs). Rolldown leaves the unresolvable specifier as a bare dynamic
|
package/lib/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as publicConfigPlugin, r as readPublicConfigKeys, t as createViteConfig } from "./vite-
|
|
1
|
+
import { n as publicConfigPlugin, r as readPublicConfigKeys, t as createViteConfig } from "./vite-n3XSaftn.js";
|
|
2
2
|
import { i as phosphorTokenColorPlugin } from "./tamaguiWorkspacePaths-B6aRC2BU.js";
|
|
3
3
|
import { n as publicPackageViteSourceAliases, t as discoverPublicPackageRoots } from "./workspacePublicPackages-ClSmVngx.js";
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/config",
|
|
3
|
-
"version": "7.34.
|
|
3
|
+
"version": "7.34.2",
|
|
4
4
|
"description": "Shared build and test configuration presets for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -99,10 +99,11 @@
|
|
|
99
99
|
"access": "public"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
|
-
"@multiplatform.one/utils": "7.34.
|
|
102
|
+
"@multiplatform.one/utils": "7.34.2",
|
|
103
103
|
"@tamagui/vite-plugin": "2.7.6",
|
|
104
|
-
"@vitejs/plugin-react": "^6.
|
|
104
|
+
"@vitejs/plugin-react": "^6.1.2",
|
|
105
105
|
"dotenv": "^17.4.2",
|
|
106
|
+
"fast-flow-transform": "^0.0.3",
|
|
106
107
|
"vite": "^8.0.10",
|
|
107
108
|
"vite-plugin-external": "^6.2.2",
|
|
108
109
|
"vite-plugin-i18next-loader": "^3.1.3",
|
package/src/vite.spec.ts
CHANGED
|
@@ -132,6 +132,34 @@ describe("nativeFixes.web3Stub", () => {
|
|
|
132
132
|
});
|
|
133
133
|
});
|
|
134
134
|
|
|
135
|
+
describe("community Flow strip (FZ-7357)", () => {
|
|
136
|
+
type FlowStrip = {
|
|
137
|
+
name: string;
|
|
138
|
+
transform: (code: string, id: string) => Promise<{ code: string } | null>;
|
|
139
|
+
};
|
|
140
|
+
const strip = () =>
|
|
141
|
+
globalWithNativePlugins.__vxrnAddNativePlugins?.find(
|
|
142
|
+
(p) => p.name === "vxrn-community-flow-strip",
|
|
143
|
+
) as unknown as FlowStrip | undefined;
|
|
144
|
+
|
|
145
|
+
it("strips Flow from @react-native-community sources on native", async () => {
|
|
146
|
+
createViteConfig({ one: true });
|
|
147
|
+
const result = await strip()!.transform(
|
|
148
|
+
"// @flow\nconst x: number = 1;\nexport default x;\n",
|
|
149
|
+
"/app/node_modules/@react-native-community/datetimepicker/src/index.js",
|
|
150
|
+
);
|
|
151
|
+
expect(result?.code).not.toContain(": number");
|
|
152
|
+
expect(result?.code).toContain("export default x");
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it("leaves every other package to vxrn", async () => {
|
|
156
|
+
createViteConfig({ one: true });
|
|
157
|
+
expect(
|
|
158
|
+
await strip()!.transform("const x = 1;", "/app/node_modules/react-native-webview/index.js"),
|
|
159
|
+
).toBeNull();
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
|
|
135
163
|
describe("public config bake", () => {
|
|
136
164
|
const bakedKeys = "VITE_MP_PUBLIC_CONFIG_KEYS";
|
|
137
165
|
const bakedValues = "VITE_MP_CONFIG";
|
package/src/vite.ts
CHANGED
|
@@ -278,6 +278,9 @@ export function createViteConfig(options: CreateViteConfigOptions = {}): UserCon
|
|
|
278
278
|
// Optional-web3 stub for apps that don't install @multiplatform.one/web3
|
|
279
279
|
// (auto-skipped when the package resolves).
|
|
280
280
|
if (nativeFixes?.web3Stub !== false) registerNativeWeb3Stub();
|
|
281
|
+
// @react-native-community/datetimepicker (an optional peer of forms and
|
|
282
|
+
// frappe-ui) ships Flow source vxrn never strips (FZ-7357).
|
|
283
|
+
registerNativeCommunityFlowStrip();
|
|
281
284
|
// CJS-only ids must land on ssr.external AFTER the one() plugin replaces
|
|
282
285
|
// the list during config — configResolved runs last, so the appends stick.
|
|
283
286
|
if (ssrCjsExternal !== false) {
|
|
@@ -936,6 +939,45 @@ function registerNativeProtoShadowFix(): void {
|
|
|
936
939
|
});
|
|
937
940
|
}
|
|
938
941
|
|
|
942
|
+
/**
|
|
943
|
+
* Flow-strip `@react-native-community/*` sources on NATIVE.
|
|
944
|
+
*
|
|
945
|
+
* vxrn's built-in flow-strip only matches `node_modules/(react-native|
|
|
946
|
+
* @react-native)/`, and the `@react-native` alternative needs a slash next, so
|
|
947
|
+
* `@react-native-community/datetimepicker` (whose package entry is its
|
|
948
|
+
* Flow-typed `src/`) is never stripped and rolldown dies with
|
|
949
|
+
* "[PARSE_ERROR] Flow is not supported". Of the optional native peers the
|
|
950
|
+
* catalog packages declare, datetimepicker is the one that ships Flow. Same
|
|
951
|
+
* mechanism as vxrn's own plugin (fast-flow-transform), scoped to the
|
|
952
|
+
* community org, so a consumer app needs no plugin of its own (FZ-7357).
|
|
953
|
+
*/
|
|
954
|
+
function registerNativeCommunityFlowStrip(): void {
|
|
955
|
+
const g = globalThis as unknown as { __vxrnAddNativePlugins?: unknown[] };
|
|
956
|
+
const name = "vxrn-community-flow-strip";
|
|
957
|
+
g.__vxrnAddNativePlugins = g.__vxrnAddNativePlugins ?? [];
|
|
958
|
+
if (g.__vxrnAddNativePlugins.some((p) => (p as { name?: string })?.name === name)) return;
|
|
959
|
+
g.__vxrnAddNativePlugins.push({
|
|
960
|
+
name,
|
|
961
|
+
async transform(code: string, id: string) {
|
|
962
|
+
if (!/node_modules[\\/]@react-native-community[\\/].*\.jsx?$/.test(id)) return null;
|
|
963
|
+
try {
|
|
964
|
+
const { default: flowTransform } = await import("fast-flow-transform");
|
|
965
|
+
const result = await flowTransform({
|
|
966
|
+
filename: id,
|
|
967
|
+
source: code,
|
|
968
|
+
sourcemap: true,
|
|
969
|
+
dialect: "flow",
|
|
970
|
+
format: "pretty",
|
|
971
|
+
});
|
|
972
|
+
return { code: result.code, map: result.map };
|
|
973
|
+
} catch (err) {
|
|
974
|
+
process.stderr.write(`[${name}] ${id}: ${(err as Error).message}\n`);
|
|
975
|
+
return null;
|
|
976
|
+
}
|
|
977
|
+
},
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
|
|
939
981
|
/**
|
|
940
982
|
* Redirect the OPTIONAL `@multiplatform.one/web3` native import to a no-op
|
|
941
983
|
* shim on NATIVE when the package is not installed (see the nativeFixes
|
package/types/vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAU,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,C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