@kodycodes/cli 3.31.2 → 3.31.4

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.
Files changed (59) hide show
  1. package/dist/{auth-WAXXS43K.js → auth-PVW2LO2U.js} +3 -3
  2. package/dist/bin.js +4 -4
  3. package/dist/{chunk-BOEXYN2R.js → chunk-327OT6ZP.js} +18 -2
  4. package/dist/{chunk-BOEXYN2R.js.map → chunk-327OT6ZP.js.map} +1 -1
  5. package/dist/{chunk-3G4MV7KG.js → chunk-6KT2QEN3.js} +3 -3
  6. package/dist/{chunk-I5GA5KSS.js → chunk-6UTLL4CZ.js} +2 -2
  7. package/dist/{chunk-PMFY674W.js → chunk-GMD3RXXS.js} +2 -2
  8. package/dist/{chunk-ZSCFP2ST.js → chunk-HPRHOM5U.js} +2 -2
  9. package/dist/{chunk-ZFK4EJKZ.js → chunk-JZRF3UXG.js} +33 -33
  10. package/dist/chunk-MAIWMWV7.js +448 -0
  11. package/dist/chunk-MAIWMWV7.js.map +6 -0
  12. package/dist/{chunk-QPSCXWFD.js → chunk-SQKXY43O.js} +6 -6
  13. package/dist/{chunk-DOTEM7EU.js → chunk-SS2SUBIJ.js} +2 -2
  14. package/dist/{chunk-MN5PENPF.js → chunk-VVXXLY65.js} +2 -2
  15. package/dist/cli.js +4 -4
  16. package/dist/{commands-3CZ5DOQA.js → commands-I5EWVOJC.js} +2 -2
  17. package/dist/{dev-command-HLWRDQGM.js → dev-command-AFVKSXJA.js} +7 -7
  18. package/dist/{git-credential-VERDXSG2.js → git-credential-FNVWEKWB.js} +4 -4
  19. package/dist/local-bundle.d.ts +1 -0
  20. package/dist/{local-execute-SNWFJZVF.js → local-execute-UTLV5UDA.js} +4 -4
  21. package/dist/{local-package-graph-QAKOKW2R.js → local-package-graph-F3AJFSSG.js} +2 -2
  22. package/dist/{local-package-run-7YMW3JUC.js → local-package-run-WMGUVB3U.js} +7 -7
  23. package/dist/{local-secrets-VINTQOMK.js → local-secrets-KZUJ2LE2.js} +2 -2
  24. package/dist/{mock-dep-resolve-D65JLWMH.js → mock-dep-resolve-IGS3ZKEO.js} +2 -2
  25. package/dist/{mock-local-deps-Q6GG4HKA.js → mock-local-deps-HT5NG52P.js} +4 -4
  26. package/dist/{open-api-client-6BTG3NTF.js → open-api-client-NRPF5SUW.js} +2 -2
  27. package/dist/open-api-client.d.ts +6 -0
  28. package/dist/publish-builder.js +319 -73
  29. package/dist/{remote-execute-CUD3J4LA.js → remote-execute-MQLJCXD7.js} +2 -2
  30. package/dist/{run-executor-J3MF4RCT.js → run-executor-N5CDFAOB.js} +2 -2
  31. package/dist/{setup-git-CZ7ECZNT.js → setup-git-6NZQISC4.js} +3 -3
  32. package/dist/{whoami-NILYMYMX.js → whoami-D2WGWIBE.js} +36 -6
  33. package/dist/whoami-D2WGWIBE.js.map +6 -0
  34. package/package.json +1 -1
  35. package/dist/chunk-YBO6HUV3.js +0 -214
  36. package/dist/chunk-YBO6HUV3.js.map +0 -6
  37. package/dist/whoami-NILYMYMX.js.map +0 -6
  38. /package/dist/{auth-WAXXS43K.js.map → auth-PVW2LO2U.js.map} +0 -0
  39. /package/dist/{chunk-3G4MV7KG.js.map → chunk-6KT2QEN3.js.map} +0 -0
  40. /package/dist/{chunk-I5GA5KSS.js.map → chunk-6UTLL4CZ.js.map} +0 -0
  41. /package/dist/{chunk-PMFY674W.js.map → chunk-GMD3RXXS.js.map} +0 -0
  42. /package/dist/{chunk-ZSCFP2ST.js.map → chunk-HPRHOM5U.js.map} +0 -0
  43. /package/dist/{chunk-ZFK4EJKZ.js.map → chunk-JZRF3UXG.js.map} +0 -0
  44. /package/dist/{chunk-QPSCXWFD.js.map → chunk-SQKXY43O.js.map} +0 -0
  45. /package/dist/{chunk-DOTEM7EU.js.map → chunk-SS2SUBIJ.js.map} +0 -0
  46. /package/dist/{chunk-MN5PENPF.js.map → chunk-VVXXLY65.js.map} +0 -0
  47. /package/dist/{commands-3CZ5DOQA.js.map → commands-I5EWVOJC.js.map} +0 -0
  48. /package/dist/{dev-command-HLWRDQGM.js.map → dev-command-AFVKSXJA.js.map} +0 -0
  49. /package/dist/{git-credential-VERDXSG2.js.map → git-credential-FNVWEKWB.js.map} +0 -0
  50. /package/dist/{local-execute-SNWFJZVF.js.map → local-execute-UTLV5UDA.js.map} +0 -0
  51. /package/dist/{local-package-graph-QAKOKW2R.js.map → local-package-graph-F3AJFSSG.js.map} +0 -0
  52. /package/dist/{local-package-run-7YMW3JUC.js.map → local-package-run-WMGUVB3U.js.map} +0 -0
  53. /package/dist/{local-secrets-VINTQOMK.js.map → local-secrets-KZUJ2LE2.js.map} +0 -0
  54. /package/dist/{mock-dep-resolve-D65JLWMH.js.map → mock-dep-resolve-IGS3ZKEO.js.map} +0 -0
  55. /package/dist/{mock-local-deps-Q6GG4HKA.js.map → mock-local-deps-HT5NG52P.js.map} +0 -0
  56. /package/dist/{open-api-client-6BTG3NTF.js.map → open-api-client-NRPF5SUW.js.map} +0 -0
  57. /package/dist/{remote-execute-CUD3J4LA.js.map → remote-execute-MQLJCXD7.js.map} +0 -0
  58. /package/dist/{run-executor-J3MF4RCT.js.map → run-executor-N5CDFAOB.js.map} +0 -0
  59. /package/dist/{setup-git-CZ7ECZNT.js.map → setup-git-6NZQISC4.js.map} +0 -0
@@ -44,6 +44,7 @@ export declare function localBundleOptions(entry: string): {
44
44
  logLevel: "silent";
45
45
  packages: "bundle";
46
46
  external: string[];
47
+ plugins: esbuild.Plugin[];
47
48
  };
48
49
  export type LocalUserBundle = {
49
50
  code: string;
@@ -4,7 +4,7 @@ import {
4
4
  forwardLocalGatewayFetchStream,
5
5
  installMockFetchShimModules,
6
6
  startLocalRuntimeBridge
7
- } from "./chunk-MN5PENPF.js";
7
+ } from "./chunk-VVXXLY65.js";
8
8
  import {
9
9
  resolveMockFetchGateway,
10
10
  tryHandleMockGatewayFetchCall
@@ -12,7 +12,7 @@ import {
12
12
  import "./chunk-LQNGII7U.js";
13
13
  import {
14
14
  bundleLocalUserModule
15
- } from "./chunk-YBO6HUV3.js";
15
+ } from "./chunk-MAIWMWV7.js";
16
16
  import "./chunk-42R5NM3P.js";
17
17
  import {
18
18
  createLocalEntrySource,
@@ -28,7 +28,7 @@ import {
28
28
  runSecretEnvVar,
29
29
  runSecretHeader,
30
30
  writePackageModuleFiles
31
- } from "./chunk-PMFY674W.js";
31
+ } from "./chunk-GMD3RXXS.js";
32
32
  import {
33
33
  createEgressGateSource,
34
34
  egressGateModuleName,
@@ -956,4 +956,4 @@ export {
956
956
  runLocalExecute,
957
957
  savedPackageImportLocalResolveStatus
958
958
  };
959
- //# sourceMappingURL=local-execute-SNWFJZVF.js.map
959
+ //# sourceMappingURL=local-execute-UTLV5UDA.js.map
@@ -24,7 +24,7 @@ import {
24
24
  rewriteLocalModulesToPackageFacades,
25
25
  synthesizePackageGraphEntry,
26
26
  writePackageModuleFiles
27
- } from "./chunk-PMFY674W.js";
27
+ } from "./chunk-GMD3RXXS.js";
28
28
  import "./chunk-F6SEQDAM.js";
29
29
  import "./chunk-H7CJBJFA.js";
30
30
  import "./chunk-CQHQFF7B.js";
@@ -60,4 +60,4 @@ export {
60
60
  synthesizePackageGraphEntry,
61
61
  writePackageModuleFiles
62
62
  };
63
- //# sourceMappingURL=local-package-graph-QAKOKW2R.js.map
63
+ //# sourceMappingURL=local-package-graph-F3AJFSSG.js.map
@@ -4,18 +4,18 @@ import {
4
4
  packageIdMatchesLocalPackage,
5
5
  resolveLocalPackageBinding,
6
6
  runLocalPackageModule
7
- } from "./chunk-QPSCXWFD.js";
8
- import "./chunk-MN5PENPF.js";
7
+ } from "./chunk-SQKXY43O.js";
8
+ import "./chunk-VVXXLY65.js";
9
9
  import "./chunk-CB3EUH4P.js";
10
10
  import "./chunk-LQNGII7U.js";
11
- import "./chunk-3G4MV7KG.js";
12
- import "./chunk-YBO6HUV3.js";
11
+ import "./chunk-6KT2QEN3.js";
12
+ import "./chunk-MAIWMWV7.js";
13
13
  import "./chunk-EMEUJKXR.js";
14
14
  import "./chunk-42R5NM3P.js";
15
- import "./chunk-PMFY674W.js";
15
+ import "./chunk-GMD3RXXS.js";
16
16
  import "./chunk-F6SEQDAM.js";
17
17
  import "./chunk-CASGRYOF.js";
18
- import "./chunk-BOEXYN2R.js";
18
+ import "./chunk-327OT6ZP.js";
19
19
  import "./chunk-H7CJBJFA.js";
20
20
  import "./chunk-CQHQFF7B.js";
21
21
  import "./chunk-MW3RLRTO.js";
@@ -31,4 +31,4 @@ export {
31
31
  resolveLocalPackageBinding,
32
32
  runLocalPackageModule
33
33
  };
34
- //# sourceMappingURL=local-package-run-7YMW3JUC.js.map
34
+ //# sourceMappingURL=local-package-run-WMGUVB3U.js.map
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  openApiRequest
4
- } from "./chunk-BOEXYN2R.js";
4
+ } from "./chunk-327OT6ZP.js";
5
5
  import "./chunk-H7CJBJFA.js";
6
6
  import "./chunk-CQHQFF7B.js";
7
7
  import "./chunk-MW3RLRTO.js";
@@ -134,4 +134,4 @@ export {
134
134
  revealRequiredMessage,
135
135
  runWithSecrets
136
136
  };
137
- //# sourceMappingURL=local-secrets-VINTQOMK.js.map
137
+ //# sourceMappingURL=local-secrets-KZUJ2LE2.js.map
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  resolveLocalExecuteBearer
4
- } from "./chunk-I5GA5KSS.js";
4
+ } from "./chunk-6UTLL4CZ.js";
5
5
  import {
6
6
  resolveScopedApiToken
7
7
  } from "./chunk-CQHQFF7B.js";
@@ -51,4 +51,4 @@ async function tryResolveMockDepResolve(input) {
51
51
  export {
52
52
  tryResolveMockDepResolve
53
53
  };
54
- //# sourceMappingURL=mock-dep-resolve-D65JLWMH.js.map
54
+ //# sourceMappingURL=mock-dep-resolve-IGS3ZKEO.js.map
@@ -4,11 +4,11 @@ import {
4
4
  parseKodyPackageSpecifier,
5
5
  resolveLocalPackageModules,
6
6
  tryLoadSelfManifest
7
- } from "./chunk-3G4MV7KG.js";
8
- import "./chunk-YBO6HUV3.js";
7
+ } from "./chunk-6KT2QEN3.js";
8
+ import "./chunk-MAIWMWV7.js";
9
9
  import "./chunk-EMEUJKXR.js";
10
10
  import "./chunk-42R5NM3P.js";
11
- import "./chunk-PMFY674W.js";
11
+ import "./chunk-GMD3RXXS.js";
12
12
  import "./chunk-F6SEQDAM.js";
13
13
  import "./chunk-H7CJBJFA.js";
14
14
  import "./chunk-CQHQFF7B.js";
@@ -24,4 +24,4 @@ export {
24
24
  resolveLocalPackageModules,
25
25
  tryLoadSelfManifest
26
26
  };
27
- //# sourceMappingURL=mock-local-deps-Q6GG4HKA.js.map
27
+ //# sourceMappingURL=mock-local-deps-HT5NG52P.js.map
@@ -13,7 +13,7 @@ import {
13
13
  openApiRequest,
14
14
  searchWithApiToken,
15
15
  whoamiWithApiToken
16
- } from "./chunk-BOEXYN2R.js";
16
+ } from "./chunk-327OT6ZP.js";
17
17
  import "./chunk-H7CJBJFA.js";
18
18
  import "./chunk-CQHQFF7B.js";
19
19
  import "./chunk-MW3RLRTO.js";
@@ -38,4 +38,4 @@ export {
38
38
  searchWithApiToken,
39
39
  whoamiWithApiToken
40
40
  };
41
- //# sourceMappingURL=open-api-client-6BTG3NTF.js.map
41
+ //# sourceMappingURL=open-api-client-NRPF5SUW.js.map
@@ -132,4 +132,10 @@ export declare function whoamiWithApiToken(input: OpenApiClientInput): Promise<{
132
132
  email: string;
133
133
  displayName: string;
134
134
  } | null;
135
+ /** Workspace this token acts in, from `GET /v1/me` when available. */
136
+ org: {
137
+ slug: string;
138
+ personal?: boolean;
139
+ kind?: 'personal' | 'team';
140
+ } | null;
135
141
  }>;
@@ -27316,6 +27316,129 @@ var init_package_audit = __esm({
27316
27316
  }
27317
27317
  });
27318
27318
 
27319
+ // ../shared/src/grant-presets.ts
27320
+ function isOrgWideReadPermission(value) {
27321
+ return orgWideReadPermissions.includes(value);
27322
+ }
27323
+ function isOrgWideManagePermission(value) {
27324
+ return orgWideManagePermissions.includes(value);
27325
+ }
27326
+ function permissionsForGrantPreset(family, preset) {
27327
+ if (family === "org") {
27328
+ throw new Error(
27329
+ "Grant presets do not apply to the org resource. Pass an explicit permission list."
27330
+ );
27331
+ }
27332
+ if (preset === "read") {
27333
+ const read = readByType[family];
27334
+ if (!read) {
27335
+ throw new Error(
27336
+ `The Read preset does not apply to ${family}. Use the Use preset instead.`
27337
+ );
27338
+ }
27339
+ return read;
27340
+ }
27341
+ const use = useByType[family];
27342
+ if (preset === "use") return use;
27343
+ const contribute = [...use, ...contributeExtraByType[family]];
27344
+ if (preset === "contribute") return contribute;
27345
+ return [...contribute, ...manageExtraByType[family]];
27346
+ }
27347
+ function isGrantablePermission(family, permission) {
27348
+ if (permission === "billing:read" || permission === "billing:write") {
27349
+ return false;
27350
+ }
27351
+ if (permission === "secret:read") return false;
27352
+ if (family === "org") {
27353
+ return orgResourceGrantable.includes(permission);
27354
+ }
27355
+ const prefix2 = `${family}:`;
27356
+ if (!permission.startsWith(prefix2)) return false;
27357
+ const action = permission.slice(prefix2.length);
27358
+ return action !== "create";
27359
+ }
27360
+ var readByType, useByType, contributeExtraByType, manageExtraByType, orgWideReadPermissions, orgWideManagePermissions, orgResourceGrantable;
27361
+ var init_grant_presets = __esm({
27362
+ "../shared/src/grant-presets.ts"() {
27363
+ "use strict";
27364
+ readByType = {
27365
+ package: ["package:read"]
27366
+ };
27367
+ useByType = {
27368
+ package: ["package:read", "package:execute"],
27369
+ app: ["app:read", "app:execute"],
27370
+ job: ["job:read", "job:execute"],
27371
+ secret: ["secret:use"],
27372
+ integration: ["integration:use", "integration:read"],
27373
+ memory: ["memory:read"],
27374
+ email: ["email:read"],
27375
+ execution_context: ["execution_context:read", "execution_context:execute"]
27376
+ };
27377
+ contributeExtraByType = {
27378
+ package: ["package:write"],
27379
+ app: [],
27380
+ job: ["job:write"],
27381
+ secret: ["secret:write"],
27382
+ integration: ["integration:write"],
27383
+ memory: ["memory:write"],
27384
+ email: ["email:send", "email:write"],
27385
+ execution_context: ["execution_context:write"]
27386
+ };
27387
+ manageExtraByType = {
27388
+ package: ["package:delete", "package:manage_access", "package:publish"],
27389
+ app: ["app:manage_access"],
27390
+ job: ["job:manage_access"],
27391
+ secret: ["secret:delete", "secret:manage_access"],
27392
+ integration: ["integration:delete", "integration:manage_access"],
27393
+ memory: ["memory:delete", "memory:manage_access"],
27394
+ email: ["email:delete", "email:manage_access"],
27395
+ execution_context: [
27396
+ "execution_context:delete",
27397
+ "execution_context:manage_access"
27398
+ ]
27399
+ };
27400
+ orgWideReadPermissions = [
27401
+ "package:read",
27402
+ "app:read",
27403
+ "job:read",
27404
+ "integration:read",
27405
+ "email:read"
27406
+ ];
27407
+ orgWideManagePermissions = [
27408
+ "package:execute",
27409
+ "package:write",
27410
+ "package:publish",
27411
+ "package:delete",
27412
+ "package:manage_access",
27413
+ "app:execute",
27414
+ "app:manage_access"
27415
+ ];
27416
+ orgResourceGrantable = [
27417
+ ...orgWideReadPermissions,
27418
+ ...orgWideManagePermissions,
27419
+ "org:read",
27420
+ "org:write",
27421
+ "org:delete",
27422
+ "org:execute",
27423
+ "package:create",
27424
+ "secret:create",
27425
+ "integration:create",
27426
+ "memory:create",
27427
+ "execution_context:create",
27428
+ "search:read",
27429
+ "member:read",
27430
+ "member:write",
27431
+ "member:delete",
27432
+ "team:read",
27433
+ "team:write",
27434
+ "team:delete",
27435
+ "audit:read",
27436
+ "token:read",
27437
+ "token:delete"
27438
+ ];
27439
+ }
27440
+ });
27441
+
27319
27442
  // ../shared/src/org-permissions.ts
27320
27443
  var resourceActions, orgResourceTypes, creatableResourceTypes, orgLevelPermissionList, orgPermissions, orgPermissionSet, retiredOrgPermissionNames, retiredOrgPermissions;
27321
27444
  var init_org_permissions = __esm({
@@ -27445,16 +27568,21 @@ var init_request_context = __esm({
27445
27568
  function resourceGrantKey(resourceType, resourceId) {
27446
27569
  return `${resourceType}:${resourceId}`;
27447
27570
  }
27448
- var allOrgPermissions;
27571
+ var allOrgPermissions, allMembersContextPermissions;
27449
27572
  var init_access_compile = __esm({
27450
27573
  "../worker/src/authorization/access-compile.ts"() {
27451
27574
  "use strict";
27575
+ init_grant_presets();
27452
27576
  init_org_permissions();
27453
27577
  init_grant_subjects();
27454
27578
  init_member_creation_permissions();
27455
27579
  init_request_context();
27456
27580
  init_live_sql();
27457
27581
  allOrgPermissions = new Set(orgPermissions);
27582
+ allMembersContextPermissions = permissionsForGrantPreset(
27583
+ "execution_context",
27584
+ "use"
27585
+ );
27458
27586
  }
27459
27587
  });
27460
27588
 
@@ -27539,72 +27667,6 @@ var init_repo = __esm({
27539
27667
  }
27540
27668
  });
27541
27669
 
27542
- // ../shared/src/grant-presets.ts
27543
- function isOrgWideReadPermission(value) {
27544
- return orgWideReadPermissions.includes(value);
27545
- }
27546
- function isOrgWideManagePermission(value) {
27547
- return orgWideManagePermissions.includes(value);
27548
- }
27549
- function isGrantablePermission(family, permission) {
27550
- if (permission === "billing:read" || permission === "billing:write") {
27551
- return false;
27552
- }
27553
- if (permission === "secret:read") return false;
27554
- if (family === "org") {
27555
- return orgResourceGrantable.includes(permission);
27556
- }
27557
- const prefix2 = `${family}:`;
27558
- if (!permission.startsWith(prefix2)) return false;
27559
- const action = permission.slice(prefix2.length);
27560
- return action !== "create";
27561
- }
27562
- var orgWideReadPermissions, orgWideManagePermissions, orgResourceGrantable;
27563
- var init_grant_presets = __esm({
27564
- "../shared/src/grant-presets.ts"() {
27565
- "use strict";
27566
- orgWideReadPermissions = [
27567
- "package:read",
27568
- "app:read",
27569
- "job:read",
27570
- "integration:read",
27571
- "email:read"
27572
- ];
27573
- orgWideManagePermissions = [
27574
- "package:execute",
27575
- "package:write",
27576
- "package:publish",
27577
- "package:delete",
27578
- "package:manage_access",
27579
- "app:execute",
27580
- "app:manage_access"
27581
- ];
27582
- orgResourceGrantable = [
27583
- ...orgWideReadPermissions,
27584
- ...orgWideManagePermissions,
27585
- "org:read",
27586
- "org:write",
27587
- "org:delete",
27588
- "org:execute",
27589
- "package:create",
27590
- "secret:create",
27591
- "integration:create",
27592
- "memory:create",
27593
- "execution_context:create",
27594
- "search:read",
27595
- "member:read",
27596
- "member:write",
27597
- "member:delete",
27598
- "team:read",
27599
- "team:write",
27600
- "team:delete",
27601
- "audit:read",
27602
- "token:read",
27603
- "token:delete"
27604
- ];
27605
- }
27606
- });
27607
-
27608
27670
  // ../shared/src/owner-person-ids.ts
27609
27671
  function requireStoredId(value, label) {
27610
27672
  const trimmed = value?.trim() ?? "";
@@ -185878,6 +185940,159 @@ var init_module_graph_import_rewriting = __esm({
185878
185940
  }
185879
185941
  });
185880
185942
 
185943
+ // ../shared/src/node-modules-resolution.ts
185944
+ function nodeModulesImportKind(esbuildKind) {
185945
+ return esbuildKind === "require-call" || esbuildKind === "require-resolve" ? "require" : "import";
185946
+ }
185947
+ function parseBarePackageSpecifier(specifier) {
185948
+ if (specifier.length === 0 || specifier.startsWith(".") || specifier.startsWith("/") || specifier.includes("\\") || /^[a-z][a-z0-9+.-]*:/i.test(specifier)) {
185949
+ return null;
185950
+ }
185951
+ const segments = specifier.split("/");
185952
+ const scoped = segments[0].startsWith("@");
185953
+ if (scoped && (segments.length < 2 || segments[1] === "")) return null;
185954
+ const nameSegmentCount = scoped ? 2 : 1;
185955
+ const packageName = segments.slice(0, nameSegmentCount).join("/");
185956
+ if (packageName.endsWith("/") || segments.slice(0, nameSegmentCount).includes("")) {
185957
+ return null;
185958
+ }
185959
+ const rest = segments.slice(nameSegmentCount).join("/");
185960
+ return { packageName, subpath: rest ? `./${rest}` : "." };
185961
+ }
185962
+ function listNodeModulesPackageDirectories(importerDirectory, packageName) {
185963
+ const absolute = importerDirectory.startsWith("/");
185964
+ const segments = importerDirectory.split("/").filter(Boolean);
185965
+ const lowest = /^[A-Za-z]:$/.test(segments[0] ?? "") ? 1 : 0;
185966
+ const directories = [];
185967
+ for (let depth = segments.length; depth >= lowest; depth -= 1) {
185968
+ if (depth > 0 && segments[depth - 1] === "node_modules") continue;
185969
+ const base = segments.slice(0, depth).join("/");
185970
+ const prefix2 = absolute ? `/${base}` : base;
185971
+ directories.push(
185972
+ prefix2 === "" || prefix2 === "/" ? `${prefix2}node_modules/${packageName}` : `${prefix2}/node_modules/${packageName}`
185973
+ );
185974
+ }
185975
+ return directories;
185976
+ }
185977
+ function resolveNodeModulesImport(input3) {
185978
+ const parsed = parseBarePackageSpecifier(input3.specifier);
185979
+ if (!parsed) return { kind: "not-found" };
185980
+ for (const packageDirectory of listNodeModulesPackageDirectories(
185981
+ input3.importerDirectory,
185982
+ parsed.packageName
185983
+ )) {
185984
+ const manifestSource = input3.fs.readFile(`${packageDirectory}/package.json`);
185985
+ const manifest = manifestSource == null ? null : parseManifest(manifestSource);
185986
+ if (manifest?.exports != null) {
185987
+ return resolveViaExports({
185988
+ ...input3,
185989
+ manifest,
185990
+ packageDirectory,
185991
+ packageName: parsed.packageName,
185992
+ subpath: parsed.subpath
185993
+ });
185994
+ }
185995
+ const resolved = parsed.subpath === "." ? resolveLegacyEntry(input3.fs, packageDirectory, manifest) : resolveFileOrDirectory(
185996
+ input3.fs,
185997
+ `${packageDirectory}/${parsed.subpath.slice(2)}`
185998
+ );
185999
+ if (resolved) return { kind: "resolved", path: resolved };
186000
+ }
186001
+ return { kind: "not-found" };
186002
+ }
186003
+ function parseManifest(source) {
186004
+ try {
186005
+ const parsed = JSON.parse(source);
186006
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
186007
+ } catch {
186008
+ return null;
186009
+ }
186010
+ }
186011
+ function resolveViaExports(input3) {
186012
+ let targets;
186013
+ try {
186014
+ targets = o2(
186015
+ { ...input3.manifest, name: input3.packageName },
186016
+ input3.subpath,
186017
+ {
186018
+ conditions: [input3.kind, ...nodeModulesExportConditions],
186019
+ unsafe: true
186020
+ }
186021
+ );
186022
+ } catch (error2) {
186023
+ return {
186024
+ kind: "error",
186025
+ message: `Could not resolve "${input3.specifier}" from "${input3.packageDirectory}": ${error2 instanceof Error ? error2.message : String(error2)}`
186026
+ };
186027
+ }
186028
+ for (const target of targets ?? []) {
186029
+ const path = normalizeJoin(input3.packageDirectory, target);
186030
+ if (path && input3.fs.fileExists(path)) return { kind: "resolved", path };
186031
+ }
186032
+ return {
186033
+ kind: "error",
186034
+ message: `Could not resolve "${input3.specifier}": "${input3.packageDirectory}/package.json" exports ${JSON.stringify(
186035
+ input3.subpath
186036
+ )} to a file that does not exist.`
186037
+ };
186038
+ }
186039
+ function resolveLegacyEntry(fs, packageDirectory, manifest) {
186040
+ for (const field of legacyEntryFields) {
186041
+ const entry = manifest?.[field];
186042
+ if (typeof entry !== "string" || entry.trim() === "") continue;
186043
+ const path = normalizeJoin(packageDirectory, entry);
186044
+ const resolved = path ? resolveFileOrDirectory(fs, path) : null;
186045
+ if (resolved) return resolved;
186046
+ }
186047
+ return resolveFileOrDirectory(fs, `${packageDirectory}/index`);
186048
+ }
186049
+ function resolveFileOrDirectory(fs, path) {
186050
+ const trimmed = path.replace(/\/+$/, "");
186051
+ if (fs.fileExists(trimmed) && path === trimmed) return trimmed;
186052
+ for (const extension of nodeModulesResolveExtensions) {
186053
+ if (fs.fileExists(`${trimmed}${extension}`)) return `${trimmed}${extension}`;
186054
+ }
186055
+ for (const extension of nodeModulesResolveExtensions) {
186056
+ const index = `${trimmed}/index${extension}`;
186057
+ if (fs.fileExists(index)) return index;
186058
+ }
186059
+ return null;
186060
+ }
186061
+ function normalizeJoin(directory, relativePath2) {
186062
+ const absolute = directory.startsWith("/");
186063
+ const segments = directory.split("/").filter(Boolean);
186064
+ const floor = segments.length;
186065
+ for (const segment of relativePath2.split("/")) {
186066
+ if (segment === "" || segment === ".") continue;
186067
+ if (segment === "..") {
186068
+ if (segments.length <= floor) return null;
186069
+ segments.pop();
186070
+ continue;
186071
+ }
186072
+ segments.push(segment);
186073
+ }
186074
+ const joined = segments.join("/");
186075
+ return absolute ? `/${joined}` : joined;
186076
+ }
186077
+ var nodeModulesExportConditions, nodeModulesResolveExtensions, legacyEntryFields;
186078
+ var init_node_modules_resolution = __esm({
186079
+ "../shared/src/node-modules-resolution.ts"() {
186080
+ "use strict";
186081
+ init_dist2();
186082
+ nodeModulesExportConditions = ["browser", "node"];
186083
+ nodeModulesResolveExtensions = [
186084
+ ".ts",
186085
+ ".tsx",
186086
+ ".js",
186087
+ ".jsx",
186088
+ ".mts",
186089
+ ".mjs",
186090
+ ".json"
186091
+ ];
186092
+ legacyEntryFields = ["module", "main"];
186093
+ }
186094
+ });
186095
+
185881
186096
  // ../worker/src/package-runtime/package-bundle-node-modules.ts
185882
186097
  function assertNoPlatformSuppliedNodeModules(input3) {
185883
186098
  const injected = Object.keys(input3.bundlerFiles).filter(
@@ -185890,9 +186105,40 @@ function assertNoPlatformSuppliedNodeModules(input3) {
185890
186105
  `${input3.bundleLabel} includes node_modules paths the package snapshot does not contain (${preview}${more}). Kody does not supply third-party modules to package bundles; declare and install dependencies in the package instead.`
185891
186106
  );
185892
186107
  }
186108
+ function createNodeModulesResolutionPlugin(files) {
186109
+ const fs = {
186110
+ readFile: (path) => files[path] ?? null,
186111
+ fileExists: (path) => Object.hasOwn(files, path)
186112
+ };
186113
+ return {
186114
+ name: "kody-node-modules-resolution",
186115
+ setup(build2) {
186116
+ build2.onResolve({ filter: /^[^./]/ }, (args) => {
186117
+ if (args.kind === "entry-point") return;
186118
+ const resolution = resolveNodeModulesImport({
186119
+ specifier: args.path,
186120
+ importerDirectory: normalizeWorkspaceModulePath(
186121
+ args.resolveDir ?? ""
186122
+ ),
186123
+ kind: nodeModulesImportKind(args.kind),
186124
+ fs
186125
+ });
186126
+ if (resolution.kind === "resolved") {
186127
+ return { path: resolution.path, namespace: "virtual" };
186128
+ }
186129
+ if (resolution.kind === "error") {
186130
+ return { errors: [{ text: resolution.message }] };
186131
+ }
186132
+ return void 0;
186133
+ });
186134
+ }
186135
+ };
186136
+ }
185893
186137
  var init_package_bundle_node_modules = __esm({
185894
186138
  "../worker/src/package-runtime/package-bundle-node-modules.ts"() {
185895
186139
  "use strict";
186140
+ init_node_modules_resolution();
186141
+ init_module_graph_path_basics();
185896
186142
  }
185897
186143
  });
185898
186144
 
@@ -186108,7 +186354,8 @@ async function createWorkerBundle(input3) {
186108
186354
  ...createPackageAppJsxBundleOptions(snapshotFiles),
186109
186355
  __dangerouslyUseEsBuildPluginsDoNotUseOrYouWillBeFired: [
186110
186356
  kodyRuntimeExternalsPlugin,
186111
- ...input3.linkKodyPackageImports ? [kodyLinkedPackageImportsPlugin] : []
186357
+ ...input3.linkKodyPackageImports ? [kodyLinkedPackageImportsPlugin] : [],
186358
+ createNodeModulesResolutionPlugin(input3.files)
186112
186359
  ]
186113
186360
  });
186114
186361
  }
@@ -186559,11 +186806,10 @@ async function buildKodyAppClientBundle(input3) {
186559
186806
  bundle: true,
186560
186807
  target: "es2022",
186561
186808
  ...createPackageAppJsxBundleOptions(input3.sourceFiles),
186562
- ...externals.length > 0 ? {
186563
- __dangerouslyUseEsBuildPluginsDoNotUseOrYouWillBeFired: [
186564
- createClientExternalsPlugin(externals)
186565
- ]
186566
- } : {}
186809
+ __dangerouslyUseEsBuildPluginsDoNotUseOrYouWillBeFired: [
186810
+ ...externals.length > 0 ? [createClientExternalsPlugin(externals)] : [],
186811
+ createNodeModulesResolutionPlugin(files)
186812
+ ]
186567
186813
  });
186568
186814
  const bundledModule = bundle.modules[bundle.mainModule];
186569
186815
  const source = typeof bundledModule === "string" ? bundledModule : typeof bundledModule?.js === "string" ? bundledModule.js : null;
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-E4R3Y6MM.js";
5
5
  import {
6
6
  openApiRequest
7
- } from "./chunk-BOEXYN2R.js";
7
+ } from "./chunk-327OT6ZP.js";
8
8
  import {
9
9
  assertTokenSafeApiUrl
10
10
  } from "./chunk-H7CJBJFA.js";
@@ -149,4 +149,4 @@ export {
149
149
  resolveRemoteExecuteCode,
150
150
  runRemoteExecuteWithToken
151
151
  };
152
- //# sourceMappingURL=remote-execute-CUD3J4LA.js.map
152
+ //# sourceMappingURL=remote-execute-MQLJCXD7.js.map
@@ -38,7 +38,7 @@ async function runContextRun(input) {
38
38
  }
39
39
  }
40
40
  const hostCommands = input.hostCommands;
41
- const { runLocalExecute } = await import("./local-execute-SNWFJZVF.js");
41
+ const { runLocalExecute } = await import("./local-execute-UTLV5UDA.js");
42
42
  let timing;
43
43
  const result = await runLocalExecute({
44
44
  code: source.code,
@@ -85,4 +85,4 @@ async function runContextRun(input) {
85
85
  export {
86
86
  runContextRun
87
87
  };
88
- //# sourceMappingURL=run-executor-J3MF4RCT.js.map
88
+ //# sourceMappingURL=run-executor-N5CDFAOB.js.map
@@ -22,9 +22,9 @@ import {
22
22
  scopesIncludeRequired,
23
23
  setupGitDefaultScopes,
24
24
  setupGitRequiredScopes
25
- } from "./chunk-ZSCFP2ST.js";
25
+ } from "./chunk-HPRHOM5U.js";
26
26
  import "./chunk-6ZYUGXVW.js";
27
- import "./chunk-BOEXYN2R.js";
27
+ import "./chunk-327OT6ZP.js";
28
28
  import "./chunk-H7CJBJFA.js";
29
29
  import "./chunk-CQHQFF7B.js";
30
30
  import "./chunk-MW3RLRTO.js";
@@ -58,4 +58,4 @@ export {
58
58
  setupGitDefaultScopes,
59
59
  setupGitRequiredScopes
60
60
  };
61
- //# sourceMappingURL=setup-git-CZ7ECZNT.js.map
61
+ //# sourceMappingURL=setup-git-6NZQISC4.js.map