capdag 0.169.414 → 0.171.419

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/build-browser.js CHANGED
@@ -31,13 +31,19 @@ const outDir = process.argv[2]
31
31
  fs.mkdirSync(outDir, { recursive: true });
32
32
 
33
33
  function stripCJS(src) {
34
- // Strip the CJS `const { TaggedUrn } = require('tagged-urn')` line and
35
- // the trailing `module.exports = {...}` block. Both are at known
36
- // positions in the source; the regex matches the full single-line
37
- // require and the multi-line module.exports object literal.
34
+ // Strip the CJS `Import TaggedUrn` comment and the trailing
35
+ // `module.exports = {...}` block, then rewrite any single-line
36
+ // `const { ... } = require('tagged-urn')` destructure into a
37
+ // destructure from `window`. The destructure may include any subset
38
+ // of names (TaggedUrn, valuesMatch, scoreTagValue, …) so long as it
39
+ // is one line; renames like `valuesMatch: taggedUrnValuesMatch` are
40
+ // preserved verbatim.
38
41
  return src
39
42
  .replace(/^\/\/.*Import TaggedUrn.*\n/m, '')
40
- .replace(/^const\s*\{\s*TaggedUrn\s*\}\s*=\s*require\s*\(\s*['"]tagged-urn['"]\s*\)\s*;?\s*$/m, '')
43
+ .replace(
44
+ /^const\s*(\{[^}]*\})\s*=\s*require\s*\(\s*['"]tagged-urn['"]\s*\)\s*;?\s*$/gm,
45
+ 'const $1 = window;'
46
+ )
41
47
  .replace(/^module\.exports\s*=\s*\{[\s\S]*?\};?\s*$/m, '');
42
48
  }
43
49
 
@@ -60,6 +66,8 @@ window.TaggedUrnBuilder = TaggedUrnBuilder;
60
66
  window.UrnMatcher = UrnMatcher;
61
67
  window.TaggedUrnError = TaggedUrnError;
62
68
  window.TaggedUrnErrorCodes = ErrorCodes;
69
+ window.valuesMatch = valuesMatch;
70
+ window.scoreTagValue = scoreTagValue;
63
71
 
64
72
  })();
65
73
  `;
@@ -102,8 +110,7 @@ ${parserSrc}
102
110
  (function() {
103
111
  'use strict';
104
112
 
105
- const { TaggedUrn } = window;
106
- if (!TaggedUrn) {
113
+ if (!window.TaggedUrn) {
107
114
  throw new Error('TaggedUrn global is not defined. Load tagged-urn.js before capdag.js.');
108
115
  }
109
116
 
package/capdag.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Follows the exact same rules as Rust, Go, and Objective-C implementations
3
3
 
4
4
  // Import TaggedUrn from the tagged-urn package
5
- const { TaggedUrn, valuesMatch: taggedUrnValuesMatch } = require('tagged-urn');
5
+ const { TaggedUrn, valuesMatch: taggedUrnValuesMatch, scoreTagValue } = require('tagged-urn');
6
6
 
7
7
  /**
8
8
  * Error types for Cap URN operations
@@ -113,12 +113,6 @@ function validatePreservedDirectionSpec(spec, tagName) {
113
113
  }
114
114
  }
115
115
 
116
- // Per-tag truth-table specificity scoring is owned by the
117
- // tagged-urn module — same scorer applies uniformly to media-URN
118
- // tags, cap-tag y-axis, and any other Tagged URN dimension. We
119
- // re-use the canonical implementation rather than duplicate it.
120
- const { scoreTagValue } = require('tagged-urn');
121
-
122
116
  /**
123
117
  * Functional category of a cap, derived from all three axes (`in`,
124
118
  * `out`, and the remaining tags). The classification is **logical** —
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Bahram Joharshamshiri",
3
3
  "dependencies": {
4
4
  "peggy": "^5.1.0",
5
- "tagged-urn": "^0.39.102"
5
+ "tagged-urn": "^0.40.107"
6
6
  },
7
7
  "description": "JavaScript implementation of Cap URN (Capability Uniform Resource Names) with strict validation and matching",
8
8
  "engines": {
@@ -40,5 +40,5 @@
40
40
  "pretest": "npm run build:parser",
41
41
  "test": "node capdag.test.js"
42
42
  },
43
- "version": "0.169.414"
43
+ "version": "0.171.419"
44
44
  }