@naylence/runtime 0.3.5-test.903 → 0.3.5-test.905

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 (36) hide show
  1. package/dist/browser/index.cjs +10 -0
  2. package/dist/browser/index.cjs.map +1 -1
  3. package/dist/browser/index.mjs +10 -1
  4. package/dist/browser/index.mjs.map +1 -1
  5. package/dist/cjs/naylence/fame/util/runtime-version.js +15 -332
  6. package/dist/cjs/naylence/fame/util/runtime-version.js.map +1 -1
  7. package/dist/cjs/plugin.js +2 -0
  8. package/dist/cjs/plugin.js.map +1 -1
  9. package/dist/cjs/runtime-isomorphic.js +4 -1
  10. package/dist/cjs/runtime-isomorphic.js.map +1 -1
  11. package/dist/cjs/version.js +11 -0
  12. package/dist/cjs/version.js.map +1 -0
  13. package/dist/esm/naylence/fame/util/runtime-version.js +15 -299
  14. package/dist/esm/naylence/fame/util/runtime-version.js.map +1 -1
  15. package/dist/esm/plugin.js +2 -0
  16. package/dist/esm/plugin.js.map +1 -1
  17. package/dist/esm/runtime-isomorphic.js +2 -0
  18. package/dist/esm/runtime-isomorphic.js.map +1 -1
  19. package/dist/esm/version.js +8 -0
  20. package/dist/esm/version.js.map +1 -0
  21. package/dist/node/index.cjs +10 -0
  22. package/dist/node/index.cjs.map +1 -1
  23. package/dist/node/index.mjs +10 -1
  24. package/dist/node/index.mjs.map +1 -1
  25. package/dist/node/node.cjs +29 -304
  26. package/dist/node/node.cjs.map +1 -1
  27. package/dist/node/node.mjs +29 -305
  28. package/dist/node/node.mjs.map +1 -1
  29. package/dist/types/naylence/fame/util/runtime-version.d.ts +12 -0
  30. package/dist/types/naylence/fame/util/runtime-version.d.ts.map +1 -1
  31. package/dist/types/plugin.d.ts.map +1 -1
  32. package/dist/types/runtime-isomorphic.d.ts +1 -0
  33. package/dist/types/runtime-isomorphic.d.ts.map +1 -1
  34. package/dist/types/version.d.ts +6 -0
  35. package/dist/types/version.d.ts.map +1 -0
  36. package/package.json +5 -5
@@ -5285,6 +5285,14 @@ for (const [name, config] of Object.entries(SQLITE_PROFILES)) {
5285
5285
  registerStorageProfile(name, config);
5286
5286
  }
5287
5287
 
5288
+ // This file is auto-generated during build - do not edit manually
5289
+ // Generated from package.json version: 0.3.5-test.905
5290
+ /**
5291
+ * The package version, injected at build time.
5292
+ * @internal
5293
+ */
5294
+ const VERSION = '0.3.5-test.905';
5295
+
5288
5296
  /**
5289
5297
  * Fame errors module - Fame protocol specific error classes
5290
5298
  */
@@ -5534,7 +5542,7 @@ class MemoryMetricsEmitter {
5534
5542
  }
5535
5543
 
5536
5544
  const POOL_WILDCARD_PREFIX = '*.';
5537
- function readEnvValue$2(aliases) {
5545
+ function readEnvValue$1(aliases) {
5538
5546
  const processRef = globalThis?.process;
5539
5547
  const env = processRef?.env;
5540
5548
  if (!env) {
@@ -5551,7 +5559,7 @@ function readEnvValue$2(aliases) {
5551
5559
  const DNS_HOSTNAME_PATTERN = /^(?=.{1,253}$)(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.?)+$/;
5552
5560
  const DNS_LABEL_PATTERN = /^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/;
5553
5561
  function getFameRoot() {
5554
- return (readEnvValue$2(['FAME_ROOT', 'fame_root', 'fameRoot', 'FameRoot']) ??
5562
+ return (readEnvValue$1(['FAME_ROOT', 'fame_root', 'fameRoot', 'FameRoot']) ??
5555
5563
  'fame.fabric');
5556
5564
  }
5557
5565
  function isPoolLogical(logical) {
@@ -5761,7 +5769,7 @@ function matchesPoolAddress(address, poolAddress) {
5761
5769
  return false;
5762
5770
  }
5763
5771
  catch (error) {
5764
- if (readEnvValue$2(['NODE_ENV', 'node_env', 'nodeEnv', 'NodeEnv']) !==
5772
+ if (readEnvValue$1(['NODE_ENV', 'node_env', 'nodeEnv', 'NodeEnv']) !==
5765
5773
  'production') {
5766
5774
  // eslint-disable-next-line no-console
5767
5775
  console.debug('matchesPoolAddress failed', error);
@@ -27391,7 +27399,7 @@ function toCamelAlias(snakeKey) {
27391
27399
  .toLowerCase()
27392
27400
  .replace(/_([a-z])/g, (_match, char) => char.toUpperCase());
27393
27401
  }
27394
- function readEnvValue$1(env, snakeKey) {
27402
+ function readEnvValue(env, snakeKey) {
27395
27403
  if (!env) {
27396
27404
  return undefined;
27397
27405
  }
@@ -27415,7 +27423,7 @@ function readEnvValue$1(env, snakeKey) {
27415
27423
  return undefined;
27416
27424
  }
27417
27425
  function resolveShowEnvelopesFlag(env) {
27418
- const candidate = readEnvValue$1(env, ENV_VAR_SHOW_ENVELOPES);
27426
+ const candidate = readEnvValue(env, ENV_VAR_SHOW_ENVELOPES);
27419
27427
  if (typeof candidate !== 'string') {
27420
27428
  return false;
27421
27429
  }
@@ -29528,308 +29536,23 @@ var httpListener = /*#__PURE__*/Object.freeze({
29528
29536
  getHttpListenerInstance: getHttpListenerInstance
29529
29537
  });
29530
29538
 
29531
- const PACKAGE_JSON_RELATIVE_PATHS = [
29532
- // Prioritize the path that resolves to this package's root so bundlers do not fetch
29533
- // non-existent workspace-level package.json files in dev environments (e.g. Vite).
29534
- '../../../../../package.json',
29535
- '../../../../../../package.json',
29536
- '../../../../package.json',
29537
- '../../../package.json',
29538
- '../../package.json',
29539
- '../package.json',
29540
- './package.json',
29541
- ];
29542
- let importWithAttributesFn;
29543
- function getImportWithAttributesFn() {
29544
- if (importWithAttributesFn !== undefined) {
29545
- return importWithAttributesFn;
29546
- }
29547
- try {
29548
- importWithAttributesFn = new Function('specifier', 'options', 'return import(specifier, options);');
29549
- }
29550
- catch {
29551
- importWithAttributesFn = null;
29552
- }
29553
- return importWithAttributesFn;
29554
- }
29555
- let cachedVersion;
29556
- let embeddedPackageVersion;
29557
- let embeddedPackageVersionPromise;
29558
- async function importEmbeddedPackageMetadata() {
29559
- const importOptions = [
29560
- { 'with': { type: 'json' } },
29561
- { 'assert': { type: 'json' } },
29562
- ];
29563
- const importFn = getImportWithAttributesFn();
29564
- if (!importFn) {
29565
- return null;
29566
- }
29567
- for (const candidatePath of PACKAGE_JSON_RELATIVE_PATHS) {
29568
- for (const options of importOptions) {
29569
- try {
29570
- const result = await importFn(candidatePath, options);
29571
- const candidate = result.default ?? result;
29572
- if (candidate && typeof candidate === 'object') {
29573
- return candidate;
29574
- }
29575
- }
29576
- catch {
29577
- // Try next option/path combination if current attempt fails.
29578
- }
29579
- }
29580
- }
29581
- return null;
29582
- }
29583
- async function resolveEmbeddedPackageVersion() {
29584
- if (embeddedPackageVersion !== undefined) {
29585
- return embeddedPackageVersion;
29586
- }
29587
- if (!embeddedPackageVersionPromise) {
29588
- embeddedPackageVersionPromise = (async () => {
29589
- const metadata = await importEmbeddedPackageMetadata();
29590
- return readVersionFromPackageJson(metadata);
29591
- })();
29592
- }
29593
- embeddedPackageVersion = await embeddedPackageVersionPromise;
29594
- return embeddedPackageVersion;
29595
- }
29596
- function readVersionFromPackageJson(candidate) {
29597
- if (!candidate || typeof candidate !== 'object') {
29598
- return null;
29599
- }
29600
- const { name, version } = candidate;
29601
- if (name === '@naylence/runtime' && typeof version === 'string') {
29602
- return version;
29603
- }
29604
- return null;
29605
- }
29606
- async function tryReadPackageVersion(absolutePath) {
29607
- try {
29608
- const [{ readFile }, pathModule] = await Promise.all([
29609
- import('node:fs/promises'),
29610
- import('node:path'),
29611
- ]);
29612
- let candidateDir = pathModule.dirname(absolutePath);
29613
- for (let depth = 0; depth < 10; depth += 1) {
29614
- const packageJsonPath = pathModule.join(candidateDir, 'package.json');
29615
- try {
29616
- const contents = await readFile(packageJsonPath, 'utf-8');
29617
- const parsed = JSON.parse(contents);
29618
- const extracted = readVersionFromPackageJson(parsed);
29619
- if (extracted) {
29620
- return extracted;
29621
- }
29622
- }
29623
- catch {
29624
- // Continue traversing upwards until we exhaust likely directories
29625
- }
29626
- const parentDir = pathModule.dirname(candidateDir);
29627
- if (parentDir === candidateDir) {
29628
- break;
29629
- }
29630
- candidateDir = parentDir;
29631
- }
29632
- }
29633
- catch {
29634
- // Ignore filesystem failures; callers will continue with other strategies
29635
- }
29636
- return null;
29637
- }
29638
- async function tryResolveVersionFromModule(resolveFn) {
29639
- if (!resolveFn) {
29640
- return null;
29641
- }
29642
- try {
29643
- const entryPoint = resolveFn('@naylence/runtime');
29644
- return await tryReadPackageVersion(entryPoint);
29645
- }
29646
- catch {
29647
- return null;
29648
- }
29649
- }
29650
- function tryGetProcessCwdFileUrl(processRef) {
29651
- const candidates = [];
29652
- if (processRef && typeof processRef.cwd === 'function') {
29653
- candidates.push(() => processRef.cwd?.());
29654
- }
29655
- if (typeof process !== 'undefined' && process && process !== processRef) {
29656
- const maybeProcess = process;
29657
- if (maybeProcess &&
29658
- typeof maybeProcess.cwd === 'function') {
29659
- candidates.push(() => maybeProcess.cwd?.());
29660
- }
29661
- }
29662
- for (const getPath of candidates) {
29663
- try {
29664
- const result = getPath();
29665
- if (typeof result === 'string' && result.length > 0) {
29666
- const normalized = result.endsWith('/') ? result : `${result}/`;
29667
- return new URL('./', `file://${normalized}`);
29668
- }
29669
- }
29670
- catch {
29671
- // Ignore candidates that throw so we can fall back to other strategies.
29672
- }
29673
- }
29674
- return null;
29675
- }
29676
- function tryGetImportMetaUrl() {
29677
- try {
29678
- // eslint-disable-next-line no-eval
29679
- return (0, eval)('import.meta.url');
29680
- }
29681
- catch {
29682
- return undefined;
29683
- }
29684
- }
29685
- function readEnvValue(env, aliases) {
29686
- if (!env) {
29687
- return undefined;
29688
- }
29689
- for (const alias of aliases) {
29690
- const value = env[alias];
29691
- if (typeof value === 'string') {
29692
- return value;
29693
- }
29694
- }
29695
- return undefined;
29696
- }
29697
- function resolveFromEnv(env) {
29698
- if (!env) {
29699
- return null;
29700
- }
29701
- const explicitRaw = readEnvValue(env, [
29702
- 'NAYLENCE_RUNTIME_VERSION',
29703
- 'naylence_runtime_version',
29704
- 'naylenceRuntimeVersion',
29705
- 'NaylenceRuntimeVersion',
29706
- ]);
29707
- const explicit = explicitRaw?.trim();
29708
- if (explicit) {
29709
- return explicit;
29710
- }
29711
- const npmName = readEnvValue(env, ['npm_package_name', 'npmPackageName']);
29712
- const npmVersion = readEnvValue(env, [
29713
- 'npm_package_version',
29714
- 'npmPackageVersion',
29715
- ]);
29716
- if (npmName === '@naylence/runtime' && typeof npmVersion === 'string') {
29717
- return npmVersion;
29718
- }
29719
- return null;
29720
- }
29721
- async function resolveFromPackageJson() {
29722
- try {
29723
- const processRef = globalThis?.process;
29724
- const cwdUrl = tryGetProcessCwdFileUrl(processRef);
29725
- try {
29726
- if (typeof require === 'function') {
29727
- // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require
29728
- const localRequire = require;
29729
- for (const candidate of PACKAGE_JSON_RELATIVE_PATHS) {
29730
- try {
29731
- const result = localRequire(candidate);
29732
- const extracted = readVersionFromPackageJson(result);
29733
- if (extracted) {
29734
- return extracted;
29735
- }
29736
- }
29737
- catch {
29738
- // Continue trying remaining candidates
29739
- }
29740
- }
29741
- // Fallback: try direct package resolution
29742
- try {
29743
- const result = localRequire('@naylence/runtime/package.json');
29744
- const extracted = readVersionFromPackageJson(result);
29745
- if (extracted) {
29746
- return extracted;
29747
- }
29748
- }
29749
- catch {
29750
- // Continue to next strategy
29751
- }
29752
- const resolvedFromLocalRequire = await tryResolveVersionFromModule(typeof localRequire.resolve === 'function'
29753
- ? (specifier) => localRequire.resolve(specifier)
29754
- : undefined);
29755
- if (resolvedFromLocalRequire) {
29756
- return resolvedFromLocalRequire;
29757
- }
29758
- }
29759
- }
29760
- catch {
29761
- // ignore and fall through to dynamic require resolution
29762
- }
29763
- const { createRequire } = await import('node:module');
29764
- const importMetaUrl = tryGetImportMetaUrl();
29765
- const baseSpecifier = importMetaUrl ?? cwdUrl ?? new URL('./', 'file:///');
29766
- const requireForCurrentModule = createRequire(baseSpecifier);
29767
- for (const candidate of PACKAGE_JSON_RELATIVE_PATHS) {
29768
- try {
29769
- const result = requireForCurrentModule(candidate);
29770
- const extracted = readVersionFromPackageJson(result);
29771
- if (extracted) {
29772
- return extracted;
29773
- }
29774
- }
29775
- catch {
29776
- // Continue trying remaining candidates
29777
- }
29778
- }
29779
- const moduleResolvedVersion = await tryResolveVersionFromModule(typeof requireForCurrentModule.resolve === 'function'
29780
- ? (specifier) => requireForCurrentModule.resolve(specifier)
29781
- : undefined);
29782
- if (moduleResolvedVersion) {
29783
- return moduleResolvedVersion;
29784
- }
29785
- const cwdRequire = cwdUrl ? createRequire(cwdUrl) : null;
29786
- if (cwdRequire) {
29787
- const cwdResolvedVersion = await tryResolveVersionFromModule(typeof cwdRequire.resolve === 'function'
29788
- ? (specifier) => cwdRequire.resolve(specifier)
29789
- : undefined);
29790
- if (cwdResolvedVersion) {
29791
- return cwdResolvedVersion;
29792
- }
29793
- try {
29794
- const result = cwdRequire('@naylence/runtime/package.json');
29795
- const extracted = readVersionFromPackageJson(result);
29796
- if (extracted) {
29797
- return extracted;
29798
- }
29799
- }
29800
- catch {
29801
- // All attempts failed
29802
- }
29803
- }
29804
- }
29805
- catch {
29806
- // Ignore failures and fall through to null
29807
- }
29808
- return null;
29809
- }
29539
+ /**
29540
+ * Resolves the runtime version.
29541
+ *
29542
+ * The version is now injected at build time from package.json into version.ts.
29543
+ * This function maintains backward compatibility by returning a Promise.
29544
+ *
29545
+ * @returns The runtime version string, or null if not available.
29546
+ */
29810
29547
  async function resolveRuntimeVersion() {
29811
- if (cachedVersion !== undefined) {
29812
- return cachedVersion;
29813
- }
29814
- const envVersion = resolveFromEnv(globalThis?.process?.env);
29815
- if (envVersion) {
29816
- cachedVersion = envVersion;
29817
- return cachedVersion;
29818
- }
29819
- const embeddedVersion = await resolveEmbeddedPackageVersion();
29820
- if (embeddedVersion) {
29821
- cachedVersion = embeddedVersion;
29822
- return cachedVersion;
29823
- }
29824
- const packageVersion = await resolveFromPackageJson();
29825
- cachedVersion = packageVersion ?? null;
29826
- return cachedVersion;
29548
+ return VERSION || null;
29827
29549
  }
29550
+ /**
29551
+ * For testing purposes only. No-op since version is now static.
29552
+ * Kept for backward compatibility with existing tests.
29553
+ */
29828
29554
  function resetCachedRuntimeVersionForTesting() {
29829
- cachedVersion = undefined;
29830
- embeddedPackageVersion = undefined;
29831
- embeddedPackageVersionPromise = undefined;
29832
- importWithAttributesFn = undefined;
29555
+ // No-op: version is now static and injected at build time
29833
29556
  }
29834
29557
 
29835
29558
  function isSinkService(service) {
@@ -31560,6 +31283,7 @@ var traceEmitterProfileFactory = /*#__PURE__*/Object.freeze({
31560
31283
  let initialized = false;
31561
31284
  const runtimePlugin = {
31562
31285
  name: 'naylence:runtime',
31286
+ version: VERSION,
31563
31287
  async register() {
31564
31288
  // console.log('[naylence:runtime] register() called, initialized=', initialized);
31565
31289
  if (initialized) {
@@ -32224,6 +31948,7 @@ exports.TtlValidationError = TtlValidationError;
32224
31948
  exports.UpstreamSessionManager = UpstreamSessionManager;
32225
31949
  exports.VALID_CURVES_BY_KTY = VALID_CURVES_BY_KTY;
32226
31950
  exports.VALID_KEY_USES = VALID_KEY_USES;
31951
+ exports.VERSION = VERSION;
32227
31952
  exports.WEBSOCKET_CONNECTION_GRANT_TYPE = WEBSOCKET_CONNECTION_GRANT_TYPE;
32228
31953
  exports.WELCOME_SERVICE_FACTORY_BASE_TYPE = WELCOME_SERVICE_FACTORY_BASE_TYPE;
32229
31954
  exports.WebSocketCloseCode = WebSocketCloseCode;