@resourcexjs/cli 2.16.0 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,28 +1,17 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var __create = Object.create;
4
- var __getProtoOf = Object.getPrototypeOf;
5
3
  var __defProp = Object.defineProperty;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __toESM = (mod, isNodeMode, target) => {
9
- target = mod != null ? __create(__getProtoOf(mod)) : {};
10
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
- for (let key of __getOwnPropNames(mod))
12
- if (!__hasOwnProp.call(to, key))
13
- __defProp(to, key, {
14
- get: () => mod[key],
15
- enumerable: true
16
- });
17
- return to;
18
- };
4
+ var __returnValue = (v) => v;
5
+ function __exportSetter(name, newValue) {
6
+ this[name] = __returnValue.bind(null, newValue);
7
+ }
19
8
  var __export = (target, all) => {
20
9
  for (var name in all)
21
10
  __defProp(target, name, {
22
11
  get: all[name],
23
12
  enumerable: true,
24
13
  configurable: true,
25
- set: (newValue) => all[name] = () => newValue
14
+ set: __exportSetter.bind(all, name)
26
15
  });
27
16
  };
28
17
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -791,7 +780,12 @@ import { promisify as promisify2 } from "util";
791
780
  import { gunzip } from "zlib";
792
781
  import { readdir as readdir2, readFile as readFile2, stat as stat2 } from "fs/promises";
793
782
  import { join as join2, relative as relative2 } from "path";
783
+ import { dirname } from "path";
784
+ import { fileURLToPath } from "url";
794
785
  import { createHash } from "crypto";
786
+ function __exportSetter2(name, newValue) {
787
+ this[name] = __returnValue2.bind(null, newValue);
788
+ }
795
789
  function $constructor(name, initializer, params) {
796
790
  function init2(inst, def) {
797
791
  if (!inst._zod) {
@@ -4513,6 +4507,33 @@ class FolderSourceLoader {
4513
4507
  return files;
4514
4508
  }
4515
4509
  }
4510
+
4511
+ class NpmSourceLoader {
4512
+ folder = new FolderSourceLoader;
4513
+ canLoad(source) {
4514
+ return source.startsWith(NPM_PREFIX);
4515
+ }
4516
+ async load(source) {
4517
+ if (!this.canLoad(source)) {
4518
+ throw new ResourceXError(`Not an npm source: ${source}`);
4519
+ }
4520
+ const packageName = source.slice(NPM_PREFIX.length);
4521
+ if (!packageName) {
4522
+ throw new ResourceXError(`Empty package name in npm source: ${source}`);
4523
+ }
4524
+ const packageDir = this.resolvePackageDir(packageName);
4525
+ const rxs = await this.folder.load(packageDir);
4526
+ return { source, files: rxs.files };
4527
+ }
4528
+ resolvePackageDir(packageName) {
4529
+ try {
4530
+ const url2 = import.meta.resolve(`${packageName}/package.json`);
4531
+ return dirname(fileURLToPath(url2));
4532
+ } catch {
4533
+ throw new ResourceXError(`Cannot resolve npm package: ${packageName}`);
4534
+ }
4535
+ }
4536
+ }
4516
4537
  function computeDigest(data) {
4517
4538
  const hash2 = createHash("sha256").update(data).digest("hex");
4518
4539
  return `sha256:${hash2}`;
@@ -4689,13 +4710,13 @@ class TypeHandlerChain {
4689
4710
  this.handlers.clear();
4690
4711
  }
4691
4712
  }
4692
- var __defProp2, __export2 = (target, all) => {
4713
+ var __defProp2, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
4693
4714
  for (var name in all)
4694
4715
  __defProp2(target, name, {
4695
4716
  get: all[name],
4696
4717
  enumerable: true,
4697
4718
  configurable: true,
4698
- set: (newValue) => all[name] = () => newValue
4719
+ set: __exportSetter2.bind(all, name)
4699
4720
  });
4700
4721
  }, BLOCK_SIZE = 512, ZERO_BLOCK, EMPTY, encoder, decoder, EOF_BUFFER, gzipAsync, exports_external, exports_core2, NEVER, $brand, $ZodAsyncError, $ZodEncodeError, globalConfig, exports_util, EVALUATING, captureStackTrace, allowsEval, getParsedType = (data) => {
4701
4722
  const t2 = typeof data;
@@ -10375,7 +10396,7 @@ var __defProp2, __export2 = (target, all) => {
10375
10396
  Codec: ZodCodec,
10376
10397
  Boolean: ZodBoolean,
10377
10398
  String: ZodString
10378
- }, ...args), ZodIssueCode, ZodFirstPartyTypeKind, z2, RECOGNIZED_KEYS, exports_coerce, ResourceXError, RXDSchema, gunzipAsync, RegistryError, textType, jsonType, binaryType, skillType, prototypeType, builtinTypes, ResourceTypeError;
10399
+ }, ...args), ZodIssueCode, ZodFirstPartyTypeKind, z2, RECOGNIZED_KEYS, exports_coerce, ResourceXError, RXDSchema, gunzipAsync, NPM_PREFIX = "npm:", RegistryError, textType, jsonType, binaryType, skillType, prototypeType, builtinTypes, ResourceTypeError;
10379
10400
  var init_dist = __esm(() => {
10380
10401
  __defProp2 = Object.defineProperty;
10381
10402
  ZERO_BLOCK = new Uint8Array(BLOCK_SIZE);
@@ -14520,7 +14541,7 @@ import { mkdir as mkdir2, readdir as readdir22, readFile, rm, stat as stat22, un
14520
14541
  import { join as join22 } from "path";
14521
14542
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
14522
14543
  import { homedir } from "os";
14523
- import { dirname, join as join3 } from "path";
14544
+ import { dirname as dirname2, join as join3 } from "path";
14524
14545
 
14525
14546
  class FileSystemRXAStore {
14526
14547
  basePath;
@@ -14794,7 +14815,7 @@ class NodeProvider {
14794
14815
  }
14795
14816
  writeConfig(config2, data) {
14796
14817
  const configPath = this.configPath(config2);
14797
- mkdirSync(dirname(configPath), { recursive: true });
14818
+ mkdirSync(dirname2(configPath), { recursive: true });
14798
14819
  writeFileSync(configPath, JSON.stringify(data, null, 2));
14799
14820
  }
14800
14821
  getRegistries(config2) {
@@ -17515,4 +17536,4 @@ var main = defineCommand({
17515
17536
  });
17516
17537
  runMain(main);
17517
17538
 
17518
- //# debugId=AA7C8D804CBA334B64756E2164756E21
17539
+ //# debugId=0BEF2903254EFD9764756E2164756E21