one 2.0.0-beta.96.1 → 2.0.0-beta.97.1

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/dist/cjs/one.cjs CHANGED
@@ -31,6 +31,7 @@ const iOS = Object.freeze({
31
31
  ...import_native.Swift,
32
32
  Widgets: import_native.Widgets,
33
33
  LiveActivities: import_native.LiveActivities,
34
+ WidgetUI: import_native.WidgetUI,
34
35
  Color: import_native.Color.ios,
35
36
  MenuAction: import_native.MenuAction,
36
37
  SplitView: import_native.SplitView,
@@ -34,6 +34,7 @@ var iOS = Object.freeze({
34
34
  ...import_native.Swift,
35
35
  Widgets: import_native.Widgets,
36
36
  LiveActivities: import_native.LiveActivities,
37
+ WidgetUI: import_native.WidgetUI,
37
38
  Color: import_native.Color.ios,
38
39
  MenuAction: import_native.MenuAction,
39
40
  SplitView: import_native.SplitView,
@@ -34,6 +34,7 @@ var iOS = Object.freeze({
34
34
  ...import_native.Swift,
35
35
  Widgets: import_native.Widgets,
36
36
  LiveActivities: import_native.LiveActivities,
37
+ WidgetUI: import_native.WidgetUI,
37
38
  Color: import_native.Color.ios,
38
39
  MenuAction: import_native.MenuAction,
39
40
  SplitView: import_native.SplitView,
@@ -1 +1 @@
1
- {"version":3,"file":"one.native.js","names":[],"sources":["cjs/one.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar one_exports = {};\n__export(one_exports, {\n One: () => One\n});\nmodule.exports = __toCommonJS(one_exports);\nvar import_native = require(\"@vxrn/native\");\nvar import_safe_area = require(\"@vxrn/safe-area\");\nfunction currentPlatform() {\n var _Reflect_get;\n var defined = (_Reflect_get = Reflect.get(globalThis, \"__ONE_PLATFORM__\")) !== null && _Reflect_get !== void 0 ? _Reflect_get : typeof process !== \"undefined\" ? process.env.ONE_PLATFORM : void 0;\n return defined === \"ios\" || defined === \"android\" || defined === \"rnx\" ? defined : \"web\";\n}\nvar iOS = Object.freeze({\n ...import_native.Swift,\n Widgets: import_native.Widgets,\n LiveActivities: import_native.LiveActivities,\n Color: import_native.Color.ios,\n MenuAction: import_native.MenuAction,\n SplitView: import_native.SplitView,\n ToolbarHost: import_native.ToolbarHost,\n ToolbarItem: import_native.ToolbarItem,\n ZoomTransitionAlignmentRectDetector: import_native.ZoomTransitionAlignmentRectDetector,\n ZoomTransitionEnabler: import_native.ZoomTransitionEnabler,\n ZoomTransitionSource: import_native.ZoomTransitionSource\n});\nvar Android = Object.freeze({\n ...import_native.Compose,\n Menu: import_native.Menu,\n ContextMenu: import_native.ContextMenu\n});\nvar SafeArea = Object.freeze({\n Provider: import_safe_area.SafeAreaProvider,\n View: import_safe_area.SafeAreaView,\n initialMetrics: import_safe_area.initialWindowMetrics,\n useFrame: import_safe_area.useSafeAreaFrame,\n useInsets: import_safe_area.useSafeAreaInsets\n});\nvar UI = Object.freeze({\n ...import_native.UI,\n Fonts: import_native.Fonts,\n SafeArea,\n Haptics: import_native.Haptics,\n TextInput: import_native.TextInput,\n useFonts: import_native.useFonts,\n useNativeState: import_native.useNativeState,\n useSizeClass: import_native.useSizeClass,\n getSizeClass: import_native.getSizeClass,\n useHinge: import_native.useHinge,\n getHinge: import_native.getHinge,\n onHingeChange: import_native.onHingeChange,\n ReservedRegions: import_native.ReservedRegions\n});\nvar One = Object.freeze({\n get platform() {\n return currentPlatform();\n },\n AppInfo: import_native.AppInfo,\n Database: import_native.Database,\n iOS,\n Android,\n UI,\n Notifications: import_native.Notifications,\n Clipboard: import_native.Clipboard,\n Network: import_native.Network,\n Browser: import_native.Browser,\n ImagePicker: import_native.ImagePicker,\n useNetworkState: import_native.useNetworkState\n});\n//# sourceMappingURL=one.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,cAAc,CAAC;AACnB,SAAS,aAAa,EACpB,WAAW,IACb,CAAC;AACD,OAAO,UAAU,aAAa,WAAW;AACzC,IAAI,gBAAgB,QAAQ,cAAc;AAC1C,IAAI,mBAAmB,QAAQ,iBAAiB;AAChD,SAAS,kBAAkB;CACzB,IAAI;CACJ,IAAI,WAAW,eAAe,QAAQ,IAAI,YAAY,kBAAkB,OAAO,QAAQ,iBAAiB,KAAK,IAAI,eAAe,OAAO,YAAY,cAAc,QAAQ,IAAI,eAAe,KAAK;CACjM,OAAO,YAAY,SAAS,YAAY,aAAa,YAAY,QAAQ,UAAU;AACrF;AACA,IAAI,MAAM,OAAO,OAAO;CACtB,GAAG,cAAc;CACjB,SAAS,cAAc;CACvB,gBAAgB,cAAc;CAC9B,OAAO,cAAc,MAAM;CAC3B,YAAY,cAAc;CAC1B,WAAW,cAAc;CACzB,aAAa,cAAc;CAC3B,aAAa,cAAc;CAC3B,qCAAqC,cAAc;CACnD,uBAAuB,cAAc;CACrC,sBAAsB,cAAc;AACtC,CAAC;AACD,IAAI,UAAU,OAAO,OAAO;CAC1B,GAAG,cAAc;CACjB,MAAM,cAAc;CACpB,aAAa,cAAc;AAC7B,CAAC;AACD,IAAI,WAAW,OAAO,OAAO;CAC3B,UAAU,iBAAiB;CAC3B,MAAM,iBAAiB;CACvB,gBAAgB,iBAAiB;CACjC,UAAU,iBAAiB;CAC3B,WAAW,iBAAiB;AAC9B,CAAC;AACD,IAAI,KAAK,OAAO,OAAO;CACrB,GAAG,cAAc;CACjB,OAAO,cAAc;CACrB;CACA,SAAS,cAAc;CACvB,WAAW,cAAc;CACzB,UAAU,cAAc;CACxB,gBAAgB,cAAc;CAC9B,cAAc,cAAc;CAC5B,cAAc,cAAc;CAC5B,UAAU,cAAc;CACxB,UAAU,cAAc;CACxB,eAAe,cAAc;CAC7B,iBAAiB,cAAc;AACjC,CAAC;AACD,IAAI,MAAM,OAAO,OAAO;CACtB,IAAI,WAAW;EACb,OAAO,gBAAgB;CACzB;CACA,SAAS,cAAc;CACvB,UAAU,cAAc;CACxB;CACA;CACA;CACA,eAAe,cAAc;CAC7B,WAAW,cAAc;CACzB,SAAS,cAAc;CACvB,SAAS,cAAc;CACvB,aAAa,cAAc;CAC3B,iBAAiB,cAAc;AACjC,CAAC"}
1
+ {"version":3,"file":"one.native.js","names":[],"sources":["cjs/one.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar one_exports = {};\n__export(one_exports, {\n One: () => One\n});\nmodule.exports = __toCommonJS(one_exports);\nvar import_native = require(\"@vxrn/native\");\nvar import_safe_area = require(\"@vxrn/safe-area\");\nfunction currentPlatform() {\n var _Reflect_get;\n var defined = (_Reflect_get = Reflect.get(globalThis, \"__ONE_PLATFORM__\")) !== null && _Reflect_get !== void 0 ? _Reflect_get : typeof process !== \"undefined\" ? process.env.ONE_PLATFORM : void 0;\n return defined === \"ios\" || defined === \"android\" || defined === \"rnx\" ? defined : \"web\";\n}\nvar iOS = Object.freeze({\n ...import_native.Swift,\n Widgets: import_native.Widgets,\n LiveActivities: import_native.LiveActivities,\n WidgetUI: import_native.WidgetUI,\n Color: import_native.Color.ios,\n MenuAction: import_native.MenuAction,\n SplitView: import_native.SplitView,\n ToolbarHost: import_native.ToolbarHost,\n ToolbarItem: import_native.ToolbarItem,\n ZoomTransitionAlignmentRectDetector: import_native.ZoomTransitionAlignmentRectDetector,\n ZoomTransitionEnabler: import_native.ZoomTransitionEnabler,\n ZoomTransitionSource: import_native.ZoomTransitionSource\n});\nvar Android = Object.freeze({\n ...import_native.Compose,\n Menu: import_native.Menu,\n ContextMenu: import_native.ContextMenu\n});\nvar SafeArea = Object.freeze({\n Provider: import_safe_area.SafeAreaProvider,\n View: import_safe_area.SafeAreaView,\n initialMetrics: import_safe_area.initialWindowMetrics,\n useFrame: import_safe_area.useSafeAreaFrame,\n useInsets: import_safe_area.useSafeAreaInsets\n});\nvar UI = Object.freeze({\n ...import_native.UI,\n Fonts: import_native.Fonts,\n SafeArea,\n Haptics: import_native.Haptics,\n TextInput: import_native.TextInput,\n useFonts: import_native.useFonts,\n useNativeState: import_native.useNativeState,\n useSizeClass: import_native.useSizeClass,\n getSizeClass: import_native.getSizeClass,\n useHinge: import_native.useHinge,\n getHinge: import_native.getHinge,\n onHingeChange: import_native.onHingeChange,\n ReservedRegions: import_native.ReservedRegions\n});\nvar One = Object.freeze({\n get platform() {\n return currentPlatform();\n },\n AppInfo: import_native.AppInfo,\n Database: import_native.Database,\n iOS,\n Android,\n UI,\n Notifications: import_native.Notifications,\n Clipboard: import_native.Clipboard,\n Network: import_native.Network,\n Browser: import_native.Browser,\n ImagePicker: import_native.ImagePicker,\n useNetworkState: import_native.useNetworkState\n});\n//# sourceMappingURL=one.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,cAAc,CAAC;AACnB,SAAS,aAAa,EACpB,WAAW,IACb,CAAC;AACD,OAAO,UAAU,aAAa,WAAW;AACzC,IAAI,gBAAgB,QAAQ,cAAc;AAC1C,IAAI,mBAAmB,QAAQ,iBAAiB;AAChD,SAAS,kBAAkB;CACzB,IAAI;CACJ,IAAI,WAAW,eAAe,QAAQ,IAAI,YAAY,kBAAkB,OAAO,QAAQ,iBAAiB,KAAK,IAAI,eAAe,OAAO,YAAY,cAAc,QAAQ,IAAI,eAAe,KAAK;CACjM,OAAO,YAAY,SAAS,YAAY,aAAa,YAAY,QAAQ,UAAU;AACrF;AACA,IAAI,MAAM,OAAO,OAAO;CACtB,GAAG,cAAc;CACjB,SAAS,cAAc;CACvB,gBAAgB,cAAc;CAC9B,UAAU,cAAc;CACxB,OAAO,cAAc,MAAM;CAC3B,YAAY,cAAc;CAC1B,WAAW,cAAc;CACzB,aAAa,cAAc;CAC3B,aAAa,cAAc;CAC3B,qCAAqC,cAAc;CACnD,uBAAuB,cAAc;CACrC,sBAAsB,cAAc;AACtC,CAAC;AACD,IAAI,UAAU,OAAO,OAAO;CAC1B,GAAG,cAAc;CACjB,MAAM,cAAc;CACpB,aAAa,cAAc;AAC7B,CAAC;AACD,IAAI,WAAW,OAAO,OAAO;CAC3B,UAAU,iBAAiB;CAC3B,MAAM,iBAAiB;CACvB,gBAAgB,iBAAiB;CACjC,UAAU,iBAAiB;CAC3B,WAAW,iBAAiB;AAC9B,CAAC;AACD,IAAI,KAAK,OAAO,OAAO;CACrB,GAAG,cAAc;CACjB,OAAO,cAAc;CACrB;CACA,SAAS,cAAc;CACvB,WAAW,cAAc;CACzB,UAAU,cAAc;CACxB,gBAAgB,cAAc;CAC9B,cAAc,cAAc;CAC5B,cAAc,cAAc;CAC5B,UAAU,cAAc;CACxB,UAAU,cAAc;CACxB,eAAe,cAAc;CAC7B,iBAAiB,cAAc;AACjC,CAAC;AACD,IAAI,MAAM,OAAO,OAAO;CACtB,IAAI,WAAW;EACb,OAAO,gBAAgB;CACzB;CACA,SAAS,cAAc;CACvB,UAAU,cAAc;CACxB;CACA;CACA;CACA,eAAe,cAAc;CAC7B,WAAW,cAAc;CACzB,SAAS,cAAc;CACvB,SAAS,cAAc;CACvB,aAAa,cAAc;CAC3B,iBAAiB,cAAc;AACjC,CAAC"}
@@ -222,6 +222,59 @@ function one(options = {}) {
222
222
  }
223
223
  }
224
224
  };
225
+ const createAliasPlugin = (alias, nativePlatform) => {
226
+ const resolveMap = (map) => {
227
+ if (!map) return null;
228
+ const out = {};
229
+ for (const [key, value] of Object.entries(map)) {
230
+ try {
231
+ out[key] = import_node_path.default.isAbsolute(value) ? value : (0, import_resolve.resolvePath)(value);
232
+ } catch {
233
+ out[key] = value;
234
+ }
235
+ }
236
+ return out;
237
+ };
238
+ const resolved = {
239
+ web: resolveMap(alias.web),
240
+ native: resolveMap(alias.native),
241
+ client: resolveMap(alias.client),
242
+ ssr: resolveMap(alias.ssr),
243
+ ios: resolveMap(alias.ios),
244
+ android: resolveMap(alias.android)
245
+ };
246
+ const aliasKeys = [...new Set(Object.values(resolved).flatMap((m) => m ? Object.keys(m) : []))];
247
+ const aliasFilter = aliasKeys.length ? new RegExp(`^(?:${aliasKeys.map((k) => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`) : /(?!)/;
248
+ return {
249
+ name: "one:alias",
250
+ enforce: "pre",
251
+ resolveId: {
252
+ filter: { id: aliasFilter },
253
+ handler(source) {
254
+ const env = nativePlatform ?? this.environment?.name;
255
+ const specific = env ? resolved[env] : null;
256
+ if (specific && source in specific) {
257
+ const id = specific[source];
258
+ return {
259
+ id,
260
+ external: false,
261
+ packageJsonPath: (0, import_vxrn.nearestPackageJson)(id)
262
+ };
263
+ }
264
+ const isWeb = !env || env === "client" || env === "ssr";
265
+ const general = isWeb ? resolved.web : resolved.native;
266
+ if (general && source in general) {
267
+ const id = general[source];
268
+ return {
269
+ id,
270
+ external: false,
271
+ packageJsonPath: (0, import_vxrn.nearestPackageJson)(id)
272
+ };
273
+ }
274
+ }
275
+ }
276
+ };
277
+ };
225
278
  const devAndProdPlugins = [
226
279
  {
227
280
  name: "one:config",
@@ -349,60 +402,7 @@ function one(options = {}) {
349
402
  }
350
403
  };
351
404
  })()],
352
- ...options.alias ? [(() => {
353
- const resolveMap = (map) => {
354
- if (!map) return null;
355
- const out = {};
356
- for (const [key, value] of Object.entries(map)) {
357
- try {
358
- out[key] = import_node_path.default.isAbsolute(value) ? value : (0, import_resolve.resolvePath)(value);
359
- } catch {
360
- out[key] = value;
361
- }
362
- }
363
- return out;
364
- };
365
- const a = options.alias;
366
- const resolved = {
367
- web: resolveMap(a.web),
368
- native: resolveMap(a.native),
369
- client: resolveMap(a.client),
370
- ssr: resolveMap(a.ssr),
371
- ios: resolveMap(a.ios),
372
- android: resolveMap(a.android)
373
- };
374
- const aliasKeys = [...new Set(Object.values(resolved).flatMap((m) => m ? Object.keys(m) : []))];
375
- const aliasFilter = aliasKeys.length ? new RegExp(`^(?:${aliasKeys.map((k) => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`) : /(?!)/;
376
- return {
377
- name: "one:alias",
378
- enforce: "pre",
379
- resolveId: {
380
- filter: { id: aliasFilter },
381
- handler(source) {
382
- const env = this.environment?.name;
383
- const specific = env ? resolved[env] : null;
384
- if (specific && source in specific) {
385
- const id = specific[source];
386
- return {
387
- id,
388
- external: false,
389
- packageJsonPath: (0, import_vxrn.nearestPackageJson)(id)
390
- };
391
- }
392
- const isWeb = !env || env === "client" || env === "ssr";
393
- const general = isWeb ? resolved.web : resolved.native;
394
- if (general && source in general) {
395
- const id = general[source];
396
- return {
397
- id,
398
- external: false,
399
- packageJsonPath: (0, import_vxrn.nearestPackageJson)(id)
400
- };
401
- }
402
- }
403
- }
404
- };
405
- })()] : [],
405
+ ...options.alias ? [createAliasPlugin(options.alias)] : [],
406
406
  {
407
407
  name: "one:redirect-rn-deep-imports",
408
408
  enforce: "pre",
@@ -555,7 +555,8 @@ function one(options = {}) {
555
555
  const nativeWebDevAndProdPlugsin = [(0, import_clientTreeShakePlugin.clientTreeShakePlugin)({ routerRoot })];
556
556
  if (!nativeDisabled) {
557
557
  const viteBundlerOptions = nativeOptions?.bundler === "metro" ? void 0 : nativeOptions?.bundlerOptions;
558
- globalThis.__vxrnAddNativePlugins = [
558
+ globalThis.__vxrnAddNativePlugins = (platform) => [
559
+ ...options.alias ? [createAliasPlugin(options.alias, platform)] : [],
559
560
  (0, import_clientTreeShakePlugin.clientTreeShakePlugin)({
560
561
  runtime: "rolldown",
561
562
  routerRoot
@@ -247,6 +247,81 @@ function one() {
247
247
  }
248
248
  }
249
249
  };
250
+ var createAliasPlugin = function(alias, nativePlatform) {
251
+ var resolveMap = function(map) {
252
+ if (!map) return null;
253
+ var out = {};
254
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
255
+ try {
256
+ for (var _iterator = Object.entries(map)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
257
+ var [key, value] = _step.value;
258
+ try {
259
+ out[key] = import_path.default.isAbsolute(value) ? value : (0, import_resolve.resolvePath)(value);
260
+ } catch (unused) {
261
+ out[key] = value;
262
+ }
263
+ }
264
+ } catch (err) {
265
+ _didIteratorError = true;
266
+ _iteratorError = err;
267
+ } finally {
268
+ try {
269
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
270
+ _iterator.return();
271
+ }
272
+ } finally {
273
+ if (_didIteratorError) {
274
+ throw _iteratorError;
275
+ }
276
+ }
277
+ }
278
+ return out;
279
+ };
280
+ var resolved = {
281
+ web: resolveMap(alias.web),
282
+ native: resolveMap(alias.native),
283
+ client: resolveMap(alias.client),
284
+ ssr: resolveMap(alias.ssr),
285
+ ios: resolveMap(alias.ios),
286
+ android: resolveMap(alias.android)
287
+ };
288
+ var aliasKeys = [...new Set(Object.values(resolved).flatMap(function(m) {
289
+ return m ? Object.keys(m) : [];
290
+ }))];
291
+ var aliasFilter = aliasKeys.length ? new RegExp(`^(?:${aliasKeys.map(function(k) {
292
+ return k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
293
+ }).join("|")})$`) : /(?!)/;
294
+ return {
295
+ name: "one:alias",
296
+ enforce: "pre",
297
+ resolveId: {
298
+ filter: { id: aliasFilter },
299
+ handler(source) {
300
+ var _this_environment;
301
+ var env = nativePlatform !== null && nativePlatform !== void 0 ? nativePlatform : (_this_environment = this.environment) === null || _this_environment === void 0 ? void 0 : _this_environment.name;
302
+ var specific = env ? resolved[env] : null;
303
+ if (specific && source in specific) {
304
+ var id = specific[source];
305
+ return {
306
+ id,
307
+ external: false,
308
+ packageJsonPath: (0, import_vxrn.nearestPackageJson)(id)
309
+ };
310
+ }
311
+ var isWeb = !env || env === "client" || env === "ssr";
312
+ var general = isWeb ? resolved.web : resolved.native;
313
+ if (general && source in general) {
314
+ var id1 = general[source];
315
+ return {
316
+ id: id1,
317
+ external: false,
318
+ packageJsonPath: (0, import_vxrn.nearestPackageJson)(id1)
319
+ };
320
+ }
321
+ }
322
+ }
323
+ };
324
+ };
250
325
  var devAndProdPlugins = [
251
326
  {
252
327
  name: "one:config",
@@ -270,8 +345,8 @@ function one() {
270
345
  {
271
346
  name: "one-define-client-env",
272
347
  async config(userConfig, env) {
273
- var _ref2, _ref12, _ref22;
274
- var clientEnvDefine = options.skipEnv ? {} : (await (0, import_vxrn.loadEnv)((_ref2 = (_ref12 = (_ref22 = vxrnOptions === null || vxrnOptions === void 0 ? void 0 : vxrnOptions.mode) !== null && _ref22 !== void 0 ? _ref22 : userConfig === null || userConfig === void 0 ? void 0 : userConfig.mode) !== null && _ref12 !== void 0 ? _ref12 : env === null || env === void 0 ? void 0 : env.mode) !== null && _ref2 !== void 0 ? _ref2 : "development", process.cwd(), userConfig === null || userConfig === void 0 ? void 0 : userConfig.envPrefix)).clientEnvDefine;
348
+ var _ref2, _ref1, _ref22;
349
+ var clientEnvDefine = options.skipEnv ? {} : (await (0, import_vxrn.loadEnv)((_ref2 = (_ref1 = (_ref22 = vxrnOptions === null || vxrnOptions === void 0 ? void 0 : vxrnOptions.mode) !== null && _ref22 !== void 0 ? _ref22 : userConfig === null || userConfig === void 0 ? void 0 : userConfig.mode) !== null && _ref1 !== void 0 ? _ref1 : env === null || env === void 0 ? void 0 : env.mode) !== null && _ref2 !== void 0 ? _ref2 : "development", process.cwd(), userConfig === null || userConfig === void 0 ? void 0 : userConfig.envPrefix)).clientEnvDefine;
275
350
  return { define: {
276
351
  ...clientEnvDefine,
277
352
  ...process.env.ONE_DEBUG_ROUTER && { "process.env.ONE_DEBUG_ROUTER": JSON.stringify(process.env.ONE_DEBUG_ROUTER) }
@@ -452,82 +527,7 @@ function one() {
452
527
  }
453
528
  };
454
529
  })()],
455
- ...options.alias ? [(function() {
456
- var resolveMap = function(map) {
457
- if (!map) return null;
458
- var out = {};
459
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
460
- try {
461
- for (var _iterator = Object.entries(map)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
462
- var [key, value] = _step.value;
463
- try {
464
- out[key] = import_path.default.isAbsolute(value) ? value : (0, import_resolve.resolvePath)(value);
465
- } catch (unused) {
466
- out[key] = value;
467
- }
468
- }
469
- } catch (err) {
470
- _didIteratorError = true;
471
- _iteratorError = err;
472
- } finally {
473
- try {
474
- if (!_iteratorNormalCompletion && _iterator.return != null) {
475
- _iterator.return();
476
- }
477
- } finally {
478
- if (_didIteratorError) {
479
- throw _iteratorError;
480
- }
481
- }
482
- }
483
- return out;
484
- };
485
- var a = options.alias;
486
- var resolved = {
487
- web: resolveMap(a.web),
488
- native: resolveMap(a.native),
489
- client: resolveMap(a.client),
490
- ssr: resolveMap(a.ssr),
491
- ios: resolveMap(a.ios),
492
- android: resolveMap(a.android)
493
- };
494
- var aliasKeys = [...new Set(Object.values(resolved).flatMap(function(m) {
495
- return m ? Object.keys(m) : [];
496
- }))];
497
- var aliasFilter = aliasKeys.length ? new RegExp(`^(?:${aliasKeys.map(function(k) {
498
- return k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
499
- }).join("|")})$`) : /(?!)/;
500
- return {
501
- name: "one:alias",
502
- enforce: "pre",
503
- resolveId: {
504
- filter: { id: aliasFilter },
505
- handler(source) {
506
- var _this_environment;
507
- var env = (_this_environment = this.environment) === null || _this_environment === void 0 ? void 0 : _this_environment.name;
508
- var specific = env ? resolved[env] : null;
509
- if (specific && source in specific) {
510
- var id = specific[source];
511
- return {
512
- id,
513
- external: false,
514
- packageJsonPath: (0, import_vxrn.nearestPackageJson)(id)
515
- };
516
- }
517
- var isWeb = !env || env === "client" || env === "ssr";
518
- var general = isWeb ? resolved.web : resolved.native;
519
- if (general && source in general) {
520
- var id1 = general[source];
521
- return {
522
- id: id1,
523
- external: false,
524
- packageJsonPath: (0, import_vxrn.nearestPackageJson)(id1)
525
- };
526
- }
527
- }
528
- }
529
- };
530
- })()] : [],
530
+ ...options.alias ? [createAliasPlugin(options.alias)] : [],
531
531
  {
532
532
  name: "one:redirect-rn-deep-imports",
533
533
  enforce: "pre",
@@ -682,16 +682,19 @@ function one() {
682
682
  ];
683
683
  var nativeWebDevAndProdPlugsin = [(0, import_clientTreeShakePlugin.clientTreeShakePlugin)({ routerRoot })];
684
684
  if (!nativeDisabled) {
685
- var _ref1;
686
685
  var viteBundlerOptions = (nativeOptions === null || nativeOptions === void 0 ? void 0 : nativeOptions.bundler) === "metro" ? void 0 : nativeOptions === null || nativeOptions === void 0 ? void 0 : nativeOptions.bundlerOptions;
687
- globalThis.__vxrnAddNativePlugins = [
688
- (0, import_clientTreeShakePlugin.clientTreeShakePlugin)({
689
- runtime: "rolldown",
690
- routerRoot
691
- }),
692
- ...(_ref1 = viteBundlerOptions === null || viteBundlerOptions === void 0 ? void 0 : viteBundlerOptions.plugins) !== null && _ref1 !== void 0 ? _ref1 : [],
693
- (0, import_swiftPackagePlugin.swiftPackagePlugin)()
694
- ];
686
+ globalThis.__vxrnAddNativePlugins = function(platform) {
687
+ var _ref2;
688
+ return [
689
+ ...options.alias ? [createAliasPlugin(options.alias, platform)] : [],
690
+ (0, import_clientTreeShakePlugin.clientTreeShakePlugin)({
691
+ runtime: "rolldown",
692
+ routerRoot
693
+ }),
694
+ ...(_ref2 = viteBundlerOptions === null || viteBundlerOptions === void 0 ? void 0 : viteBundlerOptions.plugins) !== null && _ref2 !== void 0 ? _ref2 : [],
695
+ (0, import_swiftPackagePlugin.swiftPackagePlugin)()
696
+ ];
697
+ };
695
698
  globalThis.__vxrnNativeUserDefine = {
696
699
  ...viteBundlerOptions === null || viteBundlerOptions === void 0 ? void 0 : viteBundlerOptions.define,
697
700
  ...nativeAppName && {
@@ -247,6 +247,81 @@ function one() {
247
247
  }
248
248
  }
249
249
  };
250
+ var createAliasPlugin = function(alias, nativePlatform) {
251
+ var resolveMap = function(map) {
252
+ if (!map) return null;
253
+ var out = {};
254
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
255
+ try {
256
+ for (var _iterator = Object.entries(map)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
257
+ var [key, value] = _step.value;
258
+ try {
259
+ out[key] = import_path.default.isAbsolute(value) ? value : (0, import_resolve.resolvePath)(value);
260
+ } catch (unused) {
261
+ out[key] = value;
262
+ }
263
+ }
264
+ } catch (err) {
265
+ _didIteratorError = true;
266
+ _iteratorError = err;
267
+ } finally {
268
+ try {
269
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
270
+ _iterator.return();
271
+ }
272
+ } finally {
273
+ if (_didIteratorError) {
274
+ throw _iteratorError;
275
+ }
276
+ }
277
+ }
278
+ return out;
279
+ };
280
+ var resolved = {
281
+ web: resolveMap(alias.web),
282
+ native: resolveMap(alias.native),
283
+ client: resolveMap(alias.client),
284
+ ssr: resolveMap(alias.ssr),
285
+ ios: resolveMap(alias.ios),
286
+ android: resolveMap(alias.android)
287
+ };
288
+ var aliasKeys = [...new Set(Object.values(resolved).flatMap(function(m) {
289
+ return m ? Object.keys(m) : [];
290
+ }))];
291
+ var aliasFilter = aliasKeys.length ? new RegExp(`^(?:${aliasKeys.map(function(k) {
292
+ return k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
293
+ }).join("|")})$`) : /(?!)/;
294
+ return {
295
+ name: "one:alias",
296
+ enforce: "pre",
297
+ resolveId: {
298
+ filter: { id: aliasFilter },
299
+ handler(source) {
300
+ var _this_environment;
301
+ var env = nativePlatform !== null && nativePlatform !== void 0 ? nativePlatform : (_this_environment = this.environment) === null || _this_environment === void 0 ? void 0 : _this_environment.name;
302
+ var specific = env ? resolved[env] : null;
303
+ if (specific && source in specific) {
304
+ var id = specific[source];
305
+ return {
306
+ id,
307
+ external: false,
308
+ packageJsonPath: (0, import_vxrn.nearestPackageJson)(id)
309
+ };
310
+ }
311
+ var isWeb = !env || env === "client" || env === "ssr";
312
+ var general = isWeb ? resolved.web : resolved.native;
313
+ if (general && source in general) {
314
+ var id1 = general[source];
315
+ return {
316
+ id: id1,
317
+ external: false,
318
+ packageJsonPath: (0, import_vxrn.nearestPackageJson)(id1)
319
+ };
320
+ }
321
+ }
322
+ }
323
+ };
324
+ };
250
325
  var devAndProdPlugins = [
251
326
  {
252
327
  name: "one:config",
@@ -270,8 +345,8 @@ function one() {
270
345
  {
271
346
  name: "one-define-client-env",
272
347
  async config(userConfig, env) {
273
- var _ref2, _ref12, _ref22;
274
- var clientEnvDefine = options.skipEnv ? {} : (await (0, import_vxrn.loadEnv)((_ref2 = (_ref12 = (_ref22 = vxrnOptions === null || vxrnOptions === void 0 ? void 0 : vxrnOptions.mode) !== null && _ref22 !== void 0 ? _ref22 : userConfig === null || userConfig === void 0 ? void 0 : userConfig.mode) !== null && _ref12 !== void 0 ? _ref12 : env === null || env === void 0 ? void 0 : env.mode) !== null && _ref2 !== void 0 ? _ref2 : "development", process.cwd(), userConfig === null || userConfig === void 0 ? void 0 : userConfig.envPrefix)).clientEnvDefine;
348
+ var _ref2, _ref1, _ref22;
349
+ var clientEnvDefine = options.skipEnv ? {} : (await (0, import_vxrn.loadEnv)((_ref2 = (_ref1 = (_ref22 = vxrnOptions === null || vxrnOptions === void 0 ? void 0 : vxrnOptions.mode) !== null && _ref22 !== void 0 ? _ref22 : userConfig === null || userConfig === void 0 ? void 0 : userConfig.mode) !== null && _ref1 !== void 0 ? _ref1 : env === null || env === void 0 ? void 0 : env.mode) !== null && _ref2 !== void 0 ? _ref2 : "development", process.cwd(), userConfig === null || userConfig === void 0 ? void 0 : userConfig.envPrefix)).clientEnvDefine;
275
350
  return { define: {
276
351
  ...clientEnvDefine,
277
352
  ...process.env.ONE_DEBUG_ROUTER && { "process.env.ONE_DEBUG_ROUTER": JSON.stringify(process.env.ONE_DEBUG_ROUTER) }
@@ -452,82 +527,7 @@ function one() {
452
527
  }
453
528
  };
454
529
  })()],
455
- ...options.alias ? [(function() {
456
- var resolveMap = function(map) {
457
- if (!map) return null;
458
- var out = {};
459
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
460
- try {
461
- for (var _iterator = Object.entries(map)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
462
- var [key, value] = _step.value;
463
- try {
464
- out[key] = import_path.default.isAbsolute(value) ? value : (0, import_resolve.resolvePath)(value);
465
- } catch (unused) {
466
- out[key] = value;
467
- }
468
- }
469
- } catch (err) {
470
- _didIteratorError = true;
471
- _iteratorError = err;
472
- } finally {
473
- try {
474
- if (!_iteratorNormalCompletion && _iterator.return != null) {
475
- _iterator.return();
476
- }
477
- } finally {
478
- if (_didIteratorError) {
479
- throw _iteratorError;
480
- }
481
- }
482
- }
483
- return out;
484
- };
485
- var a = options.alias;
486
- var resolved = {
487
- web: resolveMap(a.web),
488
- native: resolveMap(a.native),
489
- client: resolveMap(a.client),
490
- ssr: resolveMap(a.ssr),
491
- ios: resolveMap(a.ios),
492
- android: resolveMap(a.android)
493
- };
494
- var aliasKeys = [...new Set(Object.values(resolved).flatMap(function(m) {
495
- return m ? Object.keys(m) : [];
496
- }))];
497
- var aliasFilter = aliasKeys.length ? new RegExp(`^(?:${aliasKeys.map(function(k) {
498
- return k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
499
- }).join("|")})$`) : /(?!)/;
500
- return {
501
- name: "one:alias",
502
- enforce: "pre",
503
- resolveId: {
504
- filter: { id: aliasFilter },
505
- handler(source) {
506
- var _this_environment;
507
- var env = (_this_environment = this.environment) === null || _this_environment === void 0 ? void 0 : _this_environment.name;
508
- var specific = env ? resolved[env] : null;
509
- if (specific && source in specific) {
510
- var id = specific[source];
511
- return {
512
- id,
513
- external: false,
514
- packageJsonPath: (0, import_vxrn.nearestPackageJson)(id)
515
- };
516
- }
517
- var isWeb = !env || env === "client" || env === "ssr";
518
- var general = isWeb ? resolved.web : resolved.native;
519
- if (general && source in general) {
520
- var id1 = general[source];
521
- return {
522
- id: id1,
523
- external: false,
524
- packageJsonPath: (0, import_vxrn.nearestPackageJson)(id1)
525
- };
526
- }
527
- }
528
- }
529
- };
530
- })()] : [],
530
+ ...options.alias ? [createAliasPlugin(options.alias)] : [],
531
531
  {
532
532
  name: "one:redirect-rn-deep-imports",
533
533
  enforce: "pre",
@@ -682,16 +682,19 @@ function one() {
682
682
  ];
683
683
  var nativeWebDevAndProdPlugsin = [(0, import_clientTreeShakePlugin.clientTreeShakePlugin)({ routerRoot })];
684
684
  if (!nativeDisabled) {
685
- var _ref1;
686
685
  var viteBundlerOptions = (nativeOptions === null || nativeOptions === void 0 ? void 0 : nativeOptions.bundler) === "metro" ? void 0 : nativeOptions === null || nativeOptions === void 0 ? void 0 : nativeOptions.bundlerOptions;
687
- globalThis.__vxrnAddNativePlugins = [
688
- (0, import_clientTreeShakePlugin.clientTreeShakePlugin)({
689
- runtime: "rolldown",
690
- routerRoot
691
- }),
692
- ...(_ref1 = viteBundlerOptions === null || viteBundlerOptions === void 0 ? void 0 : viteBundlerOptions.plugins) !== null && _ref1 !== void 0 ? _ref1 : [],
693
- (0, import_swiftPackagePlugin.swiftPackagePlugin)()
694
- ];
686
+ globalThis.__vxrnAddNativePlugins = function(platform) {
687
+ var _ref2;
688
+ return [
689
+ ...options.alias ? [createAliasPlugin(options.alias, platform)] : [],
690
+ (0, import_clientTreeShakePlugin.clientTreeShakePlugin)({
691
+ runtime: "rolldown",
692
+ routerRoot
693
+ }),
694
+ ...(_ref2 = viteBundlerOptions === null || viteBundlerOptions === void 0 ? void 0 : viteBundlerOptions.plugins) !== null && _ref2 !== void 0 ? _ref2 : [],
695
+ (0, import_swiftPackagePlugin.swiftPackagePlugin)()
696
+ ];
697
+ };
695
698
  globalThis.__vxrnNativeUserDefine = {
696
699
  ...viteBundlerOptions === null || viteBundlerOptions === void 0 ? void 0 : viteBundlerOptions.define,
697
700
  ...nativeAppName && {