@gmb/bitmark-parser 7.8.0 → 7.9.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/README.md +73 -4
- package/config/bitmark.json +532 -209
- package/dist/browser/bitmark-parser.min.js +6 -6
- package/dist/browser/bitmark-parser.min.js.map +1 -1
- package/dist/browser/cjs/index.cjs +519 -267
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +73 -5
- package/dist/browser/esm/index.d.ts +73 -5
- package/dist/browser/esm/index.js +518 -267
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/esm/worker-entry.js +488 -258
- package/dist/browser/esm/worker-entry.js.map +1 -1
- package/dist/browser/wasm/bitmark_browser_full_wasm_bg.wasm +0 -0
- package/dist/browser/wasm/bitmark_json_wasm_bg.wasm +0 -0
- package/dist/browser/wasm/bitmark_wasm_bg.wasm +0 -0
- package/dist/index.cjs +34 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -3
- package/dist/index.d.ts +62 -3
- package/dist/index.js +33 -5
- package/dist/index.js.map +1 -1
- package/dist/legacy.cjs +19 -11
- package/dist/legacy.cjs.map +1 -1
- package/dist/legacy.d.cts +3 -1
- package/dist/legacy.d.ts +3 -1
- package/dist/legacy.js +19 -11
- package/dist/legacy.js.map +1 -1
- package/dist/worker-entry.cjs.map +1 -1
- package/package.json +7 -7
- package/schema/bitmark.schema.json +1 -1
- package/wasm/bitmark_wasm.d.ts +50 -28
- package/wasm/bitmark_wasm.js +207 -111
- package/wasm/bitmark_wasm_bg.wasm +0 -0
- package/wasm/bitmark_wasm_bg.wasm.d.ts +5 -2
- package/wasm/package.json +1 -1
- package/wasm-bitmark-json/bitmark_json_wasm.d.ts +71 -49
- package/wasm-bitmark-json/bitmark_json_wasm.js +255 -159
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +5 -2
- package/wasm-bitmark-json/package.json +1 -1
- package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +50 -28
- package/wasm-browser-full/bitmark_browser_full_wasm.js +207 -111
- package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm +0 -0
- package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm.d.ts +5 -2
- package/wasm-browser-full/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.cjs
CHANGED
|
@@ -59,6 +59,7 @@ __export(src_exports, {
|
|
|
59
59
|
resolve: () => resolve,
|
|
60
60
|
semanticTokens: () => semanticTokens,
|
|
61
61
|
splitBits: () => splitBits,
|
|
62
|
+
template: () => template,
|
|
62
63
|
transform: () => transform,
|
|
63
64
|
transformParallel: () => transformParallel,
|
|
64
65
|
unbreakscapeText: () => unbreakscapeText,
|
|
@@ -77,7 +78,7 @@ var import_node_module = require("module");
|
|
|
77
78
|
// src/generated/package_info.ts
|
|
78
79
|
var PACKAGE_INFO = {
|
|
79
80
|
"name": "@gmb/bitmark-parser",
|
|
80
|
-
"version": "7.
|
|
81
|
+
"version": "7.9.0",
|
|
81
82
|
"author": "Get More Brain Ltd <info@getmorebrain.com>",
|
|
82
83
|
"license": "ISC",
|
|
83
84
|
"description": "A parser for bitmark text, powered by WebAssembly."
|
|
@@ -146,6 +147,9 @@ function setLazyLoader(loader) {
|
|
|
146
147
|
function variant() {
|
|
147
148
|
return activeFeature;
|
|
148
149
|
}
|
|
150
|
+
function engineVersion(fallback) {
|
|
151
|
+
return active ? active.version() : fallback;
|
|
152
|
+
}
|
|
149
153
|
|
|
150
154
|
// src/core/hooked-transform.ts
|
|
151
155
|
function stripArray(doc) {
|
|
@@ -754,10 +758,12 @@ var BitmarkParserGenerator = class {
|
|
|
754
758
|
/**
|
|
755
759
|
* Get the version of the library.
|
|
756
760
|
*
|
|
757
|
-
* Reports the @gmb/bitmark-parser version (not a bpg version string)
|
|
761
|
+
* Reports the @gmb/bitmark-parser version (not a bpg version string): the
|
|
762
|
+
* one the loaded wasm reports, else the package's own (PLAN-224). Never
|
|
763
|
+
* throws.
|
|
758
764
|
*/
|
|
759
765
|
version() {
|
|
760
|
-
return PACKAGE_INFO.version;
|
|
766
|
+
return engineVersion(PACKAGE_INFO.version);
|
|
761
767
|
}
|
|
762
768
|
/**
|
|
763
769
|
* Convert bitmark from bitmark to JSON, or JSON to bitmark (bpg-compatible).
|
|
@@ -1607,7 +1613,8 @@ function complete(input, position, options = {}) {
|
|
|
1607
1613
|
position.character,
|
|
1608
1614
|
options.positionEncoding ?? "",
|
|
1609
1615
|
options.includeDeprecated ?? false,
|
|
1610
|
-
options.triggerCharacter ?? ""
|
|
1616
|
+
options.triggerCharacter ?? "",
|
|
1617
|
+
options.bitTemplate ?? false
|
|
1611
1618
|
)
|
|
1612
1619
|
);
|
|
1613
1620
|
}
|
|
@@ -1621,6 +1628,7 @@ function resolve(input, position, item, options = {}) {
|
|
|
1621
1628
|
position.character,
|
|
1622
1629
|
options.positionEncoding ?? "",
|
|
1623
1630
|
options.includeDeprecated ?? false,
|
|
1631
|
+
options.bitTemplate ?? false,
|
|
1624
1632
|
item.label,
|
|
1625
1633
|
item.kind
|
|
1626
1634
|
)
|
|
@@ -1728,6 +1736,26 @@ function info(options = {}) {
|
|
|
1728
1736
|
language
|
|
1729
1737
|
);
|
|
1730
1738
|
}
|
|
1739
|
+
function template(options) {
|
|
1740
|
+
const format = options.format ?? "text";
|
|
1741
|
+
const pretty = options.pretty ?? false;
|
|
1742
|
+
const indent = options.indent ?? 2;
|
|
1743
|
+
const includeDeprecated = options.includeDeprecated ?? false;
|
|
1744
|
+
const wasm = getActive();
|
|
1745
|
+
if (typeof wasm.template !== "function" || typeof wasm.template_all !== "function") {
|
|
1746
|
+
throw new UnsupportedFeatureError("template", variant());
|
|
1747
|
+
}
|
|
1748
|
+
if (options.all) {
|
|
1749
|
+
if (format === "snippet") {
|
|
1750
|
+
throw new Error("template({ all: true }) renders every bit as JSON; there is no snippet form");
|
|
1751
|
+
}
|
|
1752
|
+
return wasm.template_all(includeDeprecated, pretty, indent);
|
|
1753
|
+
}
|
|
1754
|
+
if (!options.bit) {
|
|
1755
|
+
throw new Error("template() needs a bit name, or all: true");
|
|
1756
|
+
}
|
|
1757
|
+
return wasm.template(options.bit, format, options.full ?? false, includeDeprecated, pretty, indent);
|
|
1758
|
+
}
|
|
1731
1759
|
function register(options) {
|
|
1732
1760
|
try {
|
|
1733
1761
|
getActive().register(options.type, options.data);
|
|
@@ -1757,7 +1785,7 @@ function initSync(options = {}) {
|
|
|
1757
1785
|
}
|
|
1758
1786
|
initLegacyNode(() => getActive());
|
|
1759
1787
|
function version() {
|
|
1760
|
-
return PACKAGE_INFO.version;
|
|
1788
|
+
return engineVersion(PACKAGE_INFO.version);
|
|
1761
1789
|
}
|
|
1762
1790
|
function transformParallel(input, options = {}) {
|
|
1763
1791
|
return runParallelTransform(
|
|
@@ -1797,6 +1825,7 @@ function transformParallel(input, options = {}) {
|
|
|
1797
1825
|
resolve,
|
|
1798
1826
|
semanticTokens,
|
|
1799
1827
|
splitBits,
|
|
1828
|
+
template,
|
|
1800
1829
|
transform,
|
|
1801
1830
|
transformParallel,
|
|
1802
1831
|
unbreakscapeText,
|