capdag 0.168.411 → 0.170.416
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 +6 -24
- package/capdag.js +1 -7
- package/package.json +2 -2
package/build-browser.js
CHANGED
|
@@ -31,14 +31,13 @@ const outDir = process.argv[2]
|
|
|
31
31
|
fs.mkdirSync(outDir, { recursive: true });
|
|
32
32
|
|
|
33
33
|
function stripCJS(src) {
|
|
34
|
-
// Strip
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
// The IIFE shim further down rebinds the names from `window.*`.
|
|
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.
|
|
39
38
|
return src
|
|
40
39
|
.replace(/^\/\/.*Import TaggedUrn.*\n/m, '')
|
|
41
|
-
.replace(/^const\s*\{
|
|
40
|
+
.replace(/^const\s*\{\s*TaggedUrn\s*\}\s*=\s*require\s*\(\s*['"]tagged-urn['"]\s*\)\s*;?\s*$/m, '')
|
|
42
41
|
.replace(/^module\.exports\s*=\s*\{[\s\S]*?\};?\s*$/m, '');
|
|
43
42
|
}
|
|
44
43
|
|
|
@@ -61,11 +60,6 @@ window.TaggedUrnBuilder = TaggedUrnBuilder;
|
|
|
61
60
|
window.UrnMatcher = UrnMatcher;
|
|
62
61
|
window.TaggedUrnError = TaggedUrnError;
|
|
63
62
|
window.TaggedUrnErrorCodes = ErrorCodes;
|
|
64
|
-
// scoreTagValue / valuesMatch are exported by the npm package and
|
|
65
|
-
// consumed by capdag.js. The browser shim depends on them being on
|
|
66
|
-
// window so the rebinder at the top of capdag.js can find them.
|
|
67
|
-
window.taggedUrnScoreTagValue = scoreTagValue;
|
|
68
|
-
window.taggedUrnValuesMatch = valuesMatch;
|
|
69
63
|
|
|
70
64
|
})();
|
|
71
65
|
`;
|
|
@@ -108,22 +102,10 @@ ${parserSrc}
|
|
|
108
102
|
(function() {
|
|
109
103
|
'use strict';
|
|
110
104
|
|
|
111
|
-
const { TaggedUrn
|
|
105
|
+
const { TaggedUrn } = window;
|
|
112
106
|
if (!TaggedUrn) {
|
|
113
107
|
throw new Error('TaggedUrn global is not defined. Load tagged-urn.js before capdag.js.');
|
|
114
108
|
}
|
|
115
|
-
if (typeof taggedUrnScoreTagValue !== 'function' || typeof taggedUrnValuesMatch !== 'function') {
|
|
116
|
-
throw new Error('tagged-urn.js browser bundle is out of date — missing taggedUrnScoreTagValue / taggedUrnValuesMatch.');
|
|
117
|
-
}
|
|
118
|
-
// The capdag.js source destructures these out of `require('tagged-urn')`
|
|
119
|
-
// as `{ valuesMatch: taggedUrnValuesMatch }` and `{ scoreTagValue }`.
|
|
120
|
-
// stripCJS removed the require lines; rebind the same names so the
|
|
121
|
-
// downstream code (e.g. `taggedUrnValuesMatch(inst, patt)` at the
|
|
122
|
-
// six-form matcher, `scoreTagValue(value)` in y-axis specificity)
|
|
123
|
-
// resolves cleanly.
|
|
124
|
-
// taggedUrnValuesMatch is already bound by the destructure above; alias
|
|
125
|
-
// scoreTagValue under its unprefixed name.
|
|
126
|
-
const scoreTagValue = taggedUrnScoreTagValue;
|
|
127
109
|
|
|
128
110
|
${inlinedParser}
|
|
129
111
|
|
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.
|
|
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.
|
|
43
|
+
"version": "0.170.416"
|
|
44
44
|
}
|