graphddb 0.1.0 → 0.2.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/cli.js CHANGED
@@ -2,11 +2,14 @@
2
2
  import {
3
3
  buildBridgeBundle,
4
4
  normalizeSelectSpec
5
- } from "./chunk-6LEHSX45.js";
5
+ } from "./chunk-F27INYI2.js";
6
6
  import {
7
7
  MetadataRegistry
8
8
  } from "./chunk-347U24SB.js";
9
9
 
10
+ // src/cli.ts
11
+ import { createRequire } from "module";
12
+
10
13
  // src/generated/program.ts
11
14
  import { Command } from "commander";
12
15
 
@@ -813,8 +816,27 @@ function toUrl(file) {
813
816
  const abs = isAbsolute(file) ? file : resolve(process.cwd(), file);
814
817
  return pathToFileURL(abs).href;
815
818
  }
819
+ var tsxRegistered = false;
820
+ async function ensureTsx() {
821
+ if (tsxRegistered) return;
822
+ try {
823
+ const { register } = await import("tsx/esm/api");
824
+ register();
825
+ tsxRegistered = true;
826
+ } catch {
827
+ fail(
828
+ "INVALID_ARGS",
829
+ "Loading TypeScript definition modules requires tsx. Install it as a devDependency (npm i -D tsx), or pass pre-compiled .js/.mjs modules.",
830
+ 2
831
+ );
832
+ }
833
+ }
834
+ async function importModule(file) {
835
+ if (/\.[mc]?ts$/.test(file)) await ensureTsx();
836
+ return await import(toUrl(file));
837
+ }
816
838
  async function loadDefinitionMap(file, exportName) {
817
- const mod = await import(toUrl(file));
839
+ const mod = await importModule(file);
818
840
  const value = mod[exportName];
819
841
  if (value === void 0 || value === null) {
820
842
  fail(
@@ -826,7 +848,7 @@ async function loadDefinitionMap(file, exportName) {
826
848
  return value;
827
849
  }
828
850
  async function loadOptionalMap(file, exportName) {
829
- const mod = await import(toUrl(file));
851
+ const mod = await importModule(file);
830
852
  const value = mod[exportName];
831
853
  if (value === void 0 || value === null) return {};
832
854
  return value;
@@ -846,7 +868,7 @@ var handlers = {
846
868
  if (!entry) fail("INVALID_ARGS", "Missing required option --entry.", 2);
847
869
  if (!out) fail("INVALID_ARGS", "Missing required option --out.", 2);
848
870
  try {
849
- await import(toUrl(entry));
871
+ await importModule(entry);
850
872
  const queries = await loadDefinitionMap(queriesPath ?? entry, "queries");
851
873
  const commands = await loadDefinitionMap(commandsPath ?? entry, "commands");
852
874
  const transactions = await loadOptionalMap(
@@ -886,5 +908,6 @@ var handlers = {
886
908
  };
887
909
 
888
910
  // src/cli.ts
889
- var VERSION = "0.1.0";
911
+ var require2 = createRequire(import.meta.url);
912
+ var { version: VERSION } = require2("../package.json");
890
913
  createProgram(handlers, VERSION).parseAsync(process.argv);