@assistant-ui/metro 0.0.7 → 0.0.10

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/index.cjs CHANGED
@@ -8,6 +8,11 @@ const require$1 = (0, require("node:module").createRequire)(require("url").pathT
8
8
  */
9
9
  const UPSTREAM_TRANSFORMER_ENV = "AUI_METRO_UPSTREAM_TRANSFORMER";
10
10
  /**
11
+ * Env var carrying the `backendless` option to the transformer. Metro forks its
12
+ * transform workers after `metro.config` is evaluated, so they inherit it.
13
+ */
14
+ const BACKENDLESS_ENV = "AUI_METRO_BACKENDLESS";
15
+ /**
11
16
  * Wraps a Metro (or Expo) config so assistant-ui `"use generative"` modules are
12
17
  * compiled. Such a file colocates a tool's schema, its `execute`, and its
13
18
  * `render` via {@link https://www.assistant-ui.com/docs/tools/defining-tools | defineToolkit}.
@@ -23,7 +28,10 @@ const UPSTREAM_TRANSFORMER_ENV = "AUI_METRO_UPSTREAM_TRANSFORMER";
23
28
  * const { getDefaultConfig } = require("expo/metro-config");
24
29
  * const { withAui } = require("@assistant-ui/metro");
25
30
  *
26
- * module.exports = withAui(getDefaultConfig(__dirname));
31
+ * module.exports = withAui({
32
+ * ...getDefaultConfig(__dirname),
33
+ * aui: { backendless: true },
34
+ * });
27
35
  * ```
28
36
  *
29
37
  * Authoring is identical to the web: a `"use generative"` file whose default
@@ -31,10 +39,12 @@ const UPSTREAM_TRANSFORMER_ENV = "AUI_METRO_UPSTREAM_TRANSFORMER";
31
39
  */
32
40
  function withAui(config) {
33
41
  const self = require$1.resolve("@assistant-ui/metro/transformer");
42
+ const { aui, ...baseConfig } = config;
34
43
  const upstream = config.transformer?.babelTransformerPath;
44
+ if (aui?.backendless) process.env[BACKENDLESS_ENV] = "1";
35
45
  if (upstream && upstream !== self) process.env[UPSTREAM_TRANSFORMER_ENV] = upstream;
36
46
  return {
37
- ...config,
47
+ ...baseConfig,
38
48
  transformer: {
39
49
  ...config.transformer,
40
50
  babelTransformerPath: self
@@ -42,6 +52,7 @@ function withAui(config) {
42
52
  };
43
53
  }
44
54
  //#endregion
55
+ exports.BACKENDLESS_ENV = BACKENDLESS_ENV;
45
56
  exports.UPSTREAM_TRANSFORMER_ENV = UPSTREAM_TRANSFORMER_ENV;
46
57
  exports.withAui = withAui;
47
58
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["require"],"sources":["../src/index.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nconst require = createRequire(import.meta.url);\n\n/**\n * The shape of a Metro / Expo config `withAui` accepts. Typed loosely so this\n * package needs no hard dependency on `metro` or `expo`; the input shape is\n * preserved and only `transformer.babelTransformerPath` is augmented.\n */\nexport type MetroConfigLike = {\n transformer?:\n | {\n babelTransformerPath?: string | undefined;\n [key: string]: unknown;\n }\n | undefined;\n [key: string]: unknown;\n};\n\n/**\n * Env var the transformer reads to delegate to the project's existing\n * (Expo / React Native) babel transformer. Metro forks its transform workers\n * after `metro.config` is evaluated, so they inherit this value.\n */\nexport const UPSTREAM_TRANSFORMER_ENV = \"AUI_METRO_UPSTREAM_TRANSFORMER\";\n\n/**\n * Wraps a Metro (or Expo) config so assistant-ui `\"use generative\"` modules are\n * compiled. Such a file colocates a tool's schema, its `execute`, and its\n * `render` via {@link https://www.assistant-ui.com/docs/tools/defining-tools | defineToolkit}.\n *\n * It points Metro's `babelTransformerPath` at this package's transformer, which\n * runs the `\"use generative\"` compiler and then delegates to your project's\n * existing transformer. The device (client) build keeps each tool's `render`\n * and any frontend `execute`; a server build (an Expo Router `+api` route)\n * keeps a server `execute` instead.\n *\n * ```js\n * // metro.config.js\n * const { getDefaultConfig } = require(\"expo/metro-config\");\n * const { withAui } = require(\"@assistant-ui/metro\");\n *\n * module.exports = withAui(getDefaultConfig(__dirname));\n * ```\n *\n * Authoring is identical to the web: a `\"use generative\"` file whose default\n * export is `defineToolkit({ ... })`, registered with `Tools({ toolkit })`.\n */\nexport function withAui<T extends MetroConfigLike>(config: T): T {\n const self = require.resolve(\"@assistant-ui/metro/transformer\");\n const upstream = config.transformer?.babelTransformerPath;\n\n // Guard against a double-wrap (`withAui(withAui(config))`, or a shared config\n // already wrapped): if it already points at our transformer, keep the real\n // upstream captured earlier rather than overwriting it with our own path,\n // which would make `resolveUpstream()` return this transformer and recurse.\n if (upstream && upstream !== self) {\n process.env[UPSTREAM_TRANSFORMER_ENV] = upstream;\n }\n\n return {\n ...config,\n transformer: {\n ...config.transformer,\n babelTransformerPath: self,\n },\n };\n}\n"],"mappings":";;AAEA,MAAMA,aAAAA,wBAAAA,CAAAA,CAAAA,cAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,IAAuC;;;;;;AAsB7C,MAAa,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;AAwBxC,SAAgB,QAAmC,QAAc;CAC/D,MAAM,OAAOA,UAAQ,QAAQ,iCAAiC;CAC9D,MAAM,WAAW,OAAO,aAAa;CAMrC,IAAI,YAAY,aAAa,MAC3B,QAAQ,IAAI,4BAA4B;CAG1C,OAAO;EACL,GAAG;EACH,aAAa;GACX,GAAG,OAAO;GACV,sBAAsB;EACxB;CACF;AACF"}
1
+ {"version":3,"file":"index.cjs","names":["require","createRequire"],"sources":["../src/index.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nconst require = createRequire(import.meta.url);\n\n/**\n * The shape of a Metro / Expo config `withAui` accepts. Typed loosely so this\n * package needs no hard dependency on `metro` or `expo`; the input shape is\n * preserved and only `transformer.babelTransformerPath` is augmented.\n */\nexport type MetroConfigLike = {\n /** assistant-ui options, stripped from the config handed back to Metro. */\n aui?: WithAuiOptions | undefined;\n transformer?:\n | {\n babelTransformerPath?: string | undefined;\n [key: string]: unknown;\n }\n | undefined;\n [key: string]: unknown;\n};\n\n/**\n * Env var the transformer reads to delegate to the project's existing\n * (Expo / React Native) babel transformer. Metro forks its transform workers\n * after `metro.config` is evaluated, so they inherit this value.\n */\nexport const UPSTREAM_TRANSFORMER_ENV = \"AUI_METRO_UPSTREAM_TRANSFORMER\";\n\n/**\n * Env var carrying the `backendless` option to the transformer. Metro forks its\n * transform workers after `metro.config` is evaluated, so they inherit it.\n */\nexport const BACKENDLESS_ENV = \"AUI_METRO_BACKENDLESS\";\n\nexport interface WithAuiOptions {\n /**\n * The app has no backend importing the server builds of its `\"use generative\"`\n * modules (e.g. cloud-hosted runs). Frontend/human tool schemas then stay\n * uploadable from the client instead of being assumed backend-known.\n */\n backendless?: boolean;\n}\n\n/**\n * Wraps a Metro (or Expo) config so assistant-ui `\"use generative\"` modules are\n * compiled. Such a file colocates a tool's schema, its `execute`, and its\n * `render` via {@link https://www.assistant-ui.com/docs/tools/defining-tools | defineToolkit}.\n *\n * It points Metro's `babelTransformerPath` at this package's transformer, which\n * runs the `\"use generative\"` compiler and then delegates to your project's\n * existing transformer. The device (client) build keeps each tool's `render`\n * and any frontend `execute`; a server build (an Expo Router `+api` route)\n * keeps a server `execute` instead.\n *\n * ```js\n * // metro.config.js\n * const { getDefaultConfig } = require(\"expo/metro-config\");\n * const { withAui } = require(\"@assistant-ui/metro\");\n *\n * module.exports = withAui({\n * ...getDefaultConfig(__dirname),\n * aui: { backendless: true },\n * });\n * ```\n *\n * Authoring is identical to the web: a `\"use generative\"` file whose default\n * export is `defineToolkit({ ... })`, registered with `Tools({ toolkit })`.\n */\nexport function withAui<T extends MetroConfigLike>(config: T): T {\n const self = require.resolve(\"@assistant-ui/metro/transformer\");\n // Metro validates config keys it does not recognize, so `aui` must not\n // survive into the returned config.\n const { aui, ...baseConfig } = config;\n const upstream = config.transformer?.babelTransformerPath;\n\n if (aui?.backendless) process.env[BACKENDLESS_ENV] = \"1\";\n\n // Guard against a double-wrap (`withAui(withAui(config))`, or a shared config\n // already wrapped): if it already points at our transformer, keep the real\n // upstream captured earlier rather than overwriting it with our own path,\n // which would make `resolveUpstream()` return this transformer and recurse.\n if (upstream && upstream !== self) {\n process.env[UPSTREAM_TRANSFORMER_ENV] = upstream;\n }\n\n return {\n ...baseConfig,\n transformer: {\n ...config.transformer,\n babelTransformerPath: self,\n },\n } as T;\n}\n"],"mappings":";;AAEA,MAAMA,aAAAA,wBAAUC,CAAAA,CAAAA,cAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,IAA6B;;;;;;AAwB7C,MAAa,2BAA2B;;;;;AAMxC,MAAa,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;AAoC/B,SAAgB,QAAmC,QAAc;CAC/D,MAAM,OAAOD,UAAQ,QAAQ,iCAAiC;CAG9D,MAAM,EAAE,KAAK,GAAG,eAAe;CAC/B,MAAM,WAAW,OAAO,aAAa;CAErC,IAAI,KAAK,aAAa,QAAQ,IAAI,mBAAmB;CAMrD,IAAI,YAAY,aAAa,MAC3B,QAAQ,IAAI,4BAA4B;CAG1C,OAAO;EACL,GAAG;EACH,aAAa;GACX,GAAG,OAAO;GACV,sBAAsB;EACxB;CACF;AACF"}
package/dist/index.d.cts CHANGED
@@ -5,6 +5,8 @@
5
5
  * preserved and only `transformer.babelTransformerPath` is augmented.
6
6
  */
7
7
  type MetroConfigLike = {
8
+ /** assistant-ui options, stripped from the config handed back to Metro. */
9
+ aui?: WithAuiOptions | undefined;
8
10
  transformer?: {
9
11
  babelTransformerPath?: string | undefined;
10
12
  [key: string]: unknown;
@@ -17,6 +19,19 @@ type MetroConfigLike = {
17
19
  * after `metro.config` is evaluated, so they inherit this value.
18
20
  */
19
21
  declare const UPSTREAM_TRANSFORMER_ENV = "AUI_METRO_UPSTREAM_TRANSFORMER";
22
+ /**
23
+ * Env var carrying the `backendless` option to the transformer. Metro forks its
24
+ * transform workers after `metro.config` is evaluated, so they inherit it.
25
+ */
26
+ declare const BACKENDLESS_ENV = "AUI_METRO_BACKENDLESS";
27
+ interface WithAuiOptions {
28
+ /**
29
+ * The app has no backend importing the server builds of its `"use generative"`
30
+ * modules (e.g. cloud-hosted runs). Frontend/human tool schemas then stay
31
+ * uploadable from the client instead of being assumed backend-known.
32
+ */
33
+ backendless?: boolean;
34
+ }
20
35
  /**
21
36
  * Wraps a Metro (or Expo) config so assistant-ui `"use generative"` modules are
22
37
  * compiled. Such a file colocates a tool's schema, its `execute`, and its
@@ -33,7 +48,10 @@ declare const UPSTREAM_TRANSFORMER_ENV = "AUI_METRO_UPSTREAM_TRANSFORMER";
33
48
  * const { getDefaultConfig } = require("expo/metro-config");
34
49
  * const { withAui } = require("@assistant-ui/metro");
35
50
  *
36
- * module.exports = withAui(getDefaultConfig(__dirname));
51
+ * module.exports = withAui({
52
+ * ...getDefaultConfig(__dirname),
53
+ * aui: { backendless: true },
54
+ * });
37
55
  * ```
38
56
  *
39
57
  * Authoring is identical to the web: a `"use generative"` file whose default
@@ -41,5 +59,5 @@ declare const UPSTREAM_TRANSFORMER_ENV = "AUI_METRO_UPSTREAM_TRANSFORMER";
41
59
  */
42
60
  declare function withAui<T extends MetroConfigLike>(config: T): T;
43
61
  //#endregion
44
- export { MetroConfigLike, UPSTREAM_TRANSFORMER_ENV, withAui };
62
+ export { BACKENDLESS_ENV, MetroConfigLike, UPSTREAM_TRANSFORMER_ENV, WithAuiOptions, withAui };
45
63
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;KASY;EACV;IAEM;KACC;;GAGN;;;;;;;cAQU;;;;;;;;;;;;;;;;;;;;;;;iBAwBG,QAAQ,UAAU,iBAAiB,QAAQ,IAAI"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;KASY;;EAEV,MAAM;EACN;IAEM;KACC;;GAGN;;;;;;;cAQU;;;;;cAMA;UAEI;;;;;;EAMf;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4Bc,QAAQ,UAAU,iBAAiB,QAAQ,IAAI"}
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
21
21
  value: mod,
22
22
  enumerable: true
23
23
  }) : target, mod));
@@ -40,18 +40,16 @@ _babel_types = __toESM(_babel_types, 1);
40
40
  const DIRECTIVE = "use generative";
41
41
  //#endregion
42
42
  //#region ../x-generative-compiler/dist/package.js
43
- var version = "0.0.11";
43
+ var version = "0.0.14";
44
44
  //#endregion
45
45
  //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js
46
46
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
47
- const SEMVER_SPEC_VERSION = "2.0.0";
48
- const MAX_LENGTH = 256;
49
- const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
50
47
  module.exports = {
51
- MAX_LENGTH,
48
+ MAX_LENGTH: 256,
52
49
  MAX_SAFE_COMPONENT_LENGTH: 16,
53
- MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
54
- MAX_SAFE_INTEGER,
50
+ MAX_SAFE_BUILD_LENGTH: 250,
51
+ MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER ||
52
+ /* istanbul ignore next */ 9007199254740991,
55
53
  RELEASE_TYPES: [
56
54
  "major",
57
55
  "premajor",
@@ -61,7 +59,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
61
59
  "prepatch",
62
60
  "prerelease"
63
61
  ],
64
- SEMVER_SPEC_VERSION,
62
+ SEMVER_SPEC_VERSION: "2.0.0",
65
63
  FLAG_INCLUDE_PRERELEASE: 1,
66
64
  FLAG_LOOSE: 2
67
65
  };
@@ -199,9 +197,10 @@ var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
199
197
  module.exports = class SemVer {
200
198
  constructor(version, options) {
201
199
  options = parseOptions(options);
202
- if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
203
- else version = version.version;
204
- else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
200
+ if (version instanceof SemVer) {
201
+ if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
202
+ else version = version.version;
203
+ } else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
205
204
  if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
206
205
  debug("SemVer", version, options);
207
206
  this.options = options;
@@ -654,9 +653,7 @@ var require_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
654
653
  version.minor = 0;
655
654
  version.patch = 0;
656
655
  break;
657
- case "minor":
658
- version.patch = 0;
659
- break;
656
+ case "minor": version.patch = 0;
660
657
  }
661
658
  return version.format();
662
659
  };
@@ -705,8 +702,10 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
705
702
  module.exports = class Range {
706
703
  constructor(range, options) {
707
704
  options = parseOptions(options);
708
- if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
709
- else return new Range(range.raw, options);
705
+ if (range instanceof Range) {
706
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
707
+ else return new Range(range.raw, options);
708
+ }
710
709
  if (range instanceof Comparator) {
711
710
  this.raw = range.value;
712
711
  this.set = [[range]];
@@ -876,18 +875,21 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
876
875
  let ret;
877
876
  if (isX(M)) ret = "";
878
877
  else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
879
- else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
880
- else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
881
- else if (pr) {
878
+ else if (isX(p)) {
879
+ if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
880
+ else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
881
+ } else if (pr) {
882
882
  debug("replaceCaret pr", pr);
883
- if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
884
- else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
885
- else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
883
+ if (M === "0") {
884
+ if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
885
+ else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
886
+ } else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
886
887
  } else {
887
888
  debug("no pr");
888
- if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
889
- else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
890
- else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
889
+ if (M === "0") {
890
+ if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
891
+ else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
892
+ } else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
891
893
  }
892
894
  debug("caret return", ret);
893
895
  return ret;
@@ -909,9 +911,10 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
909
911
  const anyX = xp;
910
912
  if (gtlt === "=" && anyX) gtlt = "";
911
913
  pr = options.includePrerelease ? "-0" : "";
912
- if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
913
- else ret = "*";
914
- else if (gtlt && anyX) {
914
+ if (xM) {
915
+ if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
916
+ else ret = "*";
917
+ } else if (gtlt && anyX) {
915
918
  if (xm) m = 0;
916
919
  p = 0;
917
920
  if (gtlt === ">") {
@@ -985,8 +988,10 @@ var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
985
988
  }
986
989
  constructor(comp, options) {
987
990
  options = parseOptions(options);
988
- if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
989
- else comp = comp.value;
991
+ if (comp instanceof Comparator) {
992
+ if (comp.loose === !!options.loose) return comp;
993
+ else comp = comp.value;
994
+ }
990
995
  comp = comp.trim().split(/\s+/).join(" ");
991
996
  debug("comparator", comp, options);
992
997
  this.options = options;
@@ -1306,11 +1311,15 @@ var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1306
1311
  const minimumVersion = [new Comparator(">=0.0.0")];
1307
1312
  const simpleSubset = (sub, dom, options) => {
1308
1313
  if (sub === dom) return true;
1309
- if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
1310
- else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
1311
- else sub = minimumVersion;
1312
- if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
1313
- else dom = minimumVersion;
1314
+ if (sub.length === 1 && sub[0].semver === ANY) {
1315
+ if (dom.length === 1 && dom[0].semver === ANY) return true;
1316
+ else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
1317
+ else sub = minimumVersion;
1318
+ }
1319
+ if (dom.length === 1 && dom[0].semver === ANY) {
1320
+ if (options.includePrerelease) return true;
1321
+ else dom = minimumVersion;
1322
+ }
1314
1323
  const eqSet = /* @__PURE__ */ new Set();
1315
1324
  let gt, lt;
1316
1325
  for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
@@ -1581,6 +1590,7 @@ function isLineTerminator(char) {
1581
1590
  */
1582
1591
  function compileGenerative(code, options) {
1583
1592
  const { target, filename } = options;
1593
+ const backendless = options.backendless ?? false;
1584
1594
  const ast = (0, _babel_parser.parse)(code, {
1585
1595
  sourceType: "module",
1586
1596
  plugins: parserPlugins
@@ -1607,7 +1617,7 @@ function compileGenerative(code, options) {
1607
1617
  }
1608
1618
  if (_babel_types.isIdentifier(callee, { name: TOOLKIT_WRAPPER })) {
1609
1619
  if (!object) throw new GenerativeCompileError(`${TOOLKIT_WRAPPER}() takes an inline object literal of tools`, filename);
1610
- compileToolkit(object, target, generativeInstances, interactableToolImports, toolkitSpreadNames, namespaceImports, flags, filename);
1620
+ compileToolkit(object, target, generativeInstances, interactableToolImports, toolkitSpreadNames, namespaceImports, flags, backendless, filename);
1611
1621
  path.replaceWith(object);
1612
1622
  path.skip();
1613
1623
  }
@@ -1768,6 +1778,15 @@ function collectGenerativeInstances(ast) {
1768
1778
  }
1769
1779
  return names;
1770
1780
  }
1781
+ /**
1782
+ * Wraps a pass-through generative entry (`generative.present()`) so the tool it
1783
+ * returns loses its `unstable_backendDefault` marker. The library stamps the
1784
+ * marker at runtime, out of this compiler's reach, so a backendless client
1785
+ * build strips it post-hoc instead of threading an option into the library.
1786
+ */
1787
+ function stripBackendDefaultExpression(expr) {
1788
+ return _babel_types.callExpression(_babel_types.arrowFunctionExpression([_babel_types.objectPattern([_babel_types.objectProperty(_babel_types.identifier("unstable_backendDefault"), _babel_types.identifier("_backendDefault")), _babel_types.restElement(_babel_types.identifier("tool"))])], _babel_types.identifier("tool")), [expr]);
1789
+ }
1771
1790
  function collectGenerativeFactoryImports(ast) {
1772
1791
  const names = /* @__PURE__ */ new Set();
1773
1792
  for (const statement of ast.program.body) {
@@ -2182,7 +2201,7 @@ function compileComponents(object, target, flags, filename) {
2182
2201
  * `generative.present()` passes through, the library having already split it.
2183
2202
  * Mutates the object in place and records outcomes in {@link TargetFlags}.
2184
2203
  */
2185
- function compileToolkit(object, target, instances, interactableToolImports, toolkitSpreadNames, namespaceImports, flags, filename) {
2204
+ function compileToolkit(object, target, instances, interactableToolImports, toolkitSpreadNames, namespaceImports, flags, backendless, filename) {
2186
2205
  if (target === "client") warnDuplicateToolkitNames(object, toolkitSpreadNames, filename);
2187
2206
  const nextProperties = [];
2188
2207
  for (const entry of object.properties) {
@@ -2194,6 +2213,7 @@ function compileToolkit(object, target, instances, interactableToolImports, tool
2194
2213
  }
2195
2214
  const raw = entryRawValue(entry);
2196
2215
  if (raw && isGenerativeToolEntry(raw, instances)) {
2216
+ if (backendless && target === "client" && _babel_types.isObjectProperty(entry)) entry.value = stripBackendDefaultExpression(raw);
2197
2217
  nextProperties.push(entry);
2198
2218
  continue;
2199
2219
  }
@@ -2232,11 +2252,13 @@ function compileToolkit(object, target, instances, interactableToolImports, tool
2232
2252
  } else {
2233
2253
  if (hasRender) removeMember(value, "render");
2234
2254
  if (hasRenderText) removeMember(value, "renderText");
2235
- if (execute) if (type === "backend" && !isExternal) flags.keptBackendExecute = true;
2236
- else removeMember(value, "execute");
2255
+ if (execute) {
2256
+ if (type === "backend" && !isExternal) flags.keptBackendExecute = true;
2257
+ else removeMember(value, "execute");
2258
+ }
2237
2259
  }
2238
2260
  setToolType(value, type);
2239
- setBackendDefault(value, target, type);
2261
+ setBackendDefault(value, target, type, backendless);
2240
2262
  nextProperties.push(entry);
2241
2263
  }
2242
2264
  object.properties = nextProperties;
@@ -2347,8 +2369,9 @@ function setToolType(object, type) {
2347
2369
  removeMember(object, "type");
2348
2370
  object.properties.push(_babel_types.objectProperty(_babel_types.identifier("type"), _babel_types.stringLiteral(type)));
2349
2371
  }
2350
- function setBackendDefault(object, target, type) {
2372
+ function setBackendDefault(object, target, type, backendless) {
2351
2373
  removeMember(object, "unstable_backendDefault");
2374
+ if (backendless) return;
2352
2375
  if (target !== "client" || type !== "frontend" && type !== "human") return;
2353
2376
  object.properties.push(_babel_types.objectProperty(_babel_types.identifier("unstable_backendDefault"), _babel_types.objectExpression([_babel_types.objectProperty(_babel_types.identifier("parameters"), _babel_types.booleanLiteral(true))])));
2354
2377
  }
@@ -2462,7 +2485,8 @@ function transform(props) {
2462
2485
  const { code } = compileGenerative(src, {
2463
2486
  target: isServerEnvironment(options?.customTransformOptions?.environment) ? "server" : "client",
2464
2487
  filename,
2465
- injectServerOnly: false
2488
+ injectServerOnly: false,
2489
+ backendless: process.env[require_index.BACKENDLESS_ENV] === "1"
2466
2490
  });
2467
2491
  return upstream.transform({
2468
2492
  ...props,
@@ -2483,7 +2507,9 @@ function selfCacheToken() {
2483
2507
  }
2484
2508
  function getCacheKey() {
2485
2509
  const upstream = upstreamTransformer();
2486
- return `${upstream.getCacheKey ? upstream.getCacheKey() : ""}$aui-metro:${selfCacheToken()}`;
2510
+ const base = upstream.getCacheKey ? upstream.getCacheKey() : "";
2511
+ const backendless = process.env["AUI_METRO_BACKENDLESS"] === "1" ? ":backendless" : "";
2512
+ return `${base}$aui-metro:${selfCacheToken()}${backendless}`;
2487
2513
  }
2488
2514
  //#endregion
2489
2515
  exports.getCacheKey = getCacheKey;