@tamagui/code-to-html 1.135.4 → 1.135.6

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.
@@ -1,105 +1,119 @@
1
1
  "use strict";
2
+
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: !0 });
10
- }, __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from == "object" || typeof from == "function")
12
- for (let key of __getOwnPropNames(from))
13
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- return to;
15
- };
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
16
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
23
  // If the importer is in node compatibility mode or this is not an ESM
18
24
  // file that has been converted to a CommonJS file using a Babel-
19
25
  // compatible transform (i.e. "__esModule" has not been set), then set
20
26
  // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
- mod
23
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
24
34
  var highlightLine_exports = {};
25
35
  __export(highlightLine_exports, {
26
36
  highlightLine: () => highlightLine
27
37
  });
28
38
  module.exports = __toCommonJS(highlightLine_exports);
29
- var import_hast_util_to_html = require("hast-util-to-html"), import_rehype_parse = __toESM(require("rehype-parse")), import_unified = require("unified"), lineNumberify = function lineNumberify2(ast) {
30
- var lineNum = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1, lineNumber = lineNum;
31
- return ast.reduce(function(result, node) {
32
- if (node.type === "text") {
33
- if (node.value.indexOf(`
34
- `) === -1)
35
- return node.lineNumber = lineNumber, result.nodes.push(node), result;
36
- for (var lines = node.value.split(`
37
- `), i = 0; i < lines.length; i++)
38
- i !== 0 && ++lineNumber, !(i === lines.length - 1 && lines[i].length === 0) && result.nodes.push({
39
+ var import_hast_util_to_html = require("hast-util-to-html"),
40
+ import_rehype_parse = __toESM(require("rehype-parse")),
41
+ import_unified = require("unified"),
42
+ lineNumberify = function lineNumberify2(ast) {
43
+ var lineNum = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1,
44
+ lineNumber = lineNum;
45
+ return ast.reduce(function (result, node) {
46
+ if (node.type === "text") {
47
+ if (node.value.indexOf(`
48
+ `) === -1) return node.lineNumber = lineNumber, result.nodes.push(node), result;
49
+ for (var lines = node.value.split(`
50
+ `), i = 0; i < lines.length; i++) i !== 0 && ++lineNumber, !(i === lines.length - 1 && lines[i].length === 0) && result.nodes.push({
39
51
  type: "text",
40
52
  value: i === lines.length - 1 ? lines[i] : `${lines[i]}
41
53
  `,
42
54
  lineNumber
43
55
  });
44
- return result.lineNumber = lineNumber, result;
45
- }
46
- if (node.children) {
47
- node.lineNumber = lineNumber;
48
- var processed = lineNumberify2(node.children, lineNumber);
49
- return node.children = processed.nodes, result.lineNumber = processed.lineNumber, result.nodes.push(node), result;
50
- }
51
- return result.nodes.push(node), result;
52
- }, {
53
- nodes: [],
54
- lineNumber
55
- });
56
- }, wrapLines = function(ast, linesToHighlight) {
57
- var highlightAll = linesToHighlight.length === 1 && linesToHighlight[0] === 0, allLines = Array.from(new Set(ast.map(function(x) {
58
- return x.lineNumber;
59
- }))), i = 0, wrapped = allLines.reduce(function(nodes, marker) {
60
- for (var line = marker, children = []; i < ast.length; i++) {
61
- if (ast[i].lineNumber < line) {
62
- nodes.push(ast[i]);
63
- continue;
56
+ return result.lineNumber = lineNumber, result;
64
57
  }
65
- if (ast[i].lineNumber === line) {
66
- children.push(ast[i]);
67
- continue;
58
+ if (node.children) {
59
+ node.lineNumber = lineNumber;
60
+ var processed = lineNumberify2(node.children, lineNumber);
61
+ return node.children = processed.nodes, result.lineNumber = processed.lineNumber, result.nodes.push(node), result;
68
62
  }
69
- if (ast[i].lineNumber > line)
70
- break;
71
- }
72
- return nodes.push({
73
- type: "element",
74
- tagName: "div",
75
- properties: {
76
- dataLine: line,
77
- className: "highlight-line",
78
- dataHighlighted: linesToHighlight.includes(line) || highlightAll ? "true" : "false"
79
- },
80
- children,
81
- lineNumber: line
82
- }), nodes;
83
- }, []);
84
- return wrapped;
85
- }, MULTILINE_TOKEN_SPAN = /<span class="token ([^"]+)">[^<]*\n[^<]*<\/span>/g, applyMultilineFix = function(ast) {
86
- var html = (0, import_hast_util_to_html.toHtml)(ast);
87
- html = html.replace(MULTILINE_TOKEN_SPAN, function(match, token) {
88
- return match.replace(/\n/g, `</span>
63
+ return result.nodes.push(node), result;
64
+ }, {
65
+ nodes: [],
66
+ lineNumber
67
+ });
68
+ },
69
+ wrapLines = function (ast, linesToHighlight) {
70
+ var highlightAll = linesToHighlight.length === 1 && linesToHighlight[0] === 0,
71
+ allLines = Array.from(new Set(ast.map(function (x) {
72
+ return x.lineNumber;
73
+ }))),
74
+ i = 0,
75
+ wrapped = allLines.reduce(function (nodes, marker) {
76
+ for (var line = marker, children = []; i < ast.length; i++) {
77
+ if (ast[i].lineNumber < line) {
78
+ nodes.push(ast[i]);
79
+ continue;
80
+ }
81
+ if (ast[i].lineNumber === line) {
82
+ children.push(ast[i]);
83
+ continue;
84
+ }
85
+ if (ast[i].lineNumber > line) break;
86
+ }
87
+ return nodes.push({
88
+ type: "element",
89
+ tagName: "div",
90
+ properties: {
91
+ dataLine: line,
92
+ className: "highlight-line",
93
+ dataHighlighted: linesToHighlight.includes(line) || highlightAll ? "true" : "false"
94
+ },
95
+ children,
96
+ lineNumber: line
97
+ }), nodes;
98
+ }, []);
99
+ return wrapped;
100
+ },
101
+ MULTILINE_TOKEN_SPAN = /<span class="token ([^"]+)">[^<]*\n[^<]*<\/span>/g,
102
+ applyMultilineFix = function (ast) {
103
+ var html = (0, import_hast_util_to_html.toHtml)(ast);
104
+ html = html.replace(MULTILINE_TOKEN_SPAN, function (match, token) {
105
+ return match.replace(/\n/g, `</span>
89
106
  <span class="token ${token}">`);
90
- });
91
- var hast = (0, import_unified.unified)().use(import_rehype_parse.default, {
92
- emitParseErrors: !0,
93
- fragment: !0
94
- }).parse(html);
95
- return hast.children;
96
- };
107
+ });
108
+ var hast = (0, import_unified.unified)().use(import_rehype_parse.default, {
109
+ emitParseErrors: !0,
110
+ fragment: !0
111
+ }).parse(html);
112
+ return hast.children;
113
+ };
97
114
  function highlightLine(ast, lines) {
98
- var formattedAst = applyMultilineFix(ast), numbered = lineNumberify(formattedAst).nodes;
115
+ var formattedAst = applyMultilineFix(ast),
116
+ numbered = lineNumberify(formattedAst).nodes;
99
117
  return wrapLines(numbered, lines);
100
118
  }
101
- // Annotate the CommonJS export names for ESM import in node:
102
- 0 && (module.exports = {
103
- highlightLine
104
- });
105
- //# sourceMappingURL=highlightLine.js.map
119
+ //# sourceMappingURL=highlightLine.native.js.map
@@ -1,6 +1 @@
1
- {
2
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":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","highlightLine_exports","__export","highlightLine","module","exports","import_hast_util_to_html","require","import_rehype_parse","__toESM","import_unified","lineNumberify","lineNumberify2","ast","lineNum","arguments","length","lineNumber","reduce","result","node","type","indexOf","nodes","push","lines","split","i","children","processed","wrapLines","linesToHighlight","highlightAll","allLines","Array","from","Set","map","x","wrapped","marker","line","tagName","properties","dataLine","className","dataHighlighted","includes","MULTILINE_TOKEN_SPAN","applyMultilineFix","html","toHtml","replace","match","token","hast","unified","use","default","emitParseErrors","fragment","parse"],"sources":["../../src/highlightLine.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,qBAAA;AAAAC,QAAA,CAAAD,qBAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAEAC,MAAA,CAAAC,OAAA,GAAAT,YAAA,CAAAK,qBAAuB;AAIvB,IAAAK,wBAAsB,GAASC,OAAA,oBAAmB;EAAUC,mBAAG,GAAAC,OAAA,CAAAF,OAAA;EAAAG,cAAA,GAAAH,OAAA;EAAAI,aAAA,YAAAC,eAAAC,GAAA;IAC7D,IAAIC,OAAA,GAAAC,SAAa,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;MAAAE,UAAA,GAAAH,OAAA;IACjB,OAAOD,GAAA,CAAIK,MAAA,WAAAC,MAAA,EAAAC,IAAA;MACT,IAACA,IAAA,CAAQC,IAAA,KAAS;QAChB,IAAID,IAAA,CAAKpB,KAAA,CAAAsB,OAAS;AAChB,WAAiC,OAAAF,IAAA,CAAAH,UAAA,GAAAA,UAAA,EAAAE,MAAA,CAAAI,KAAA,CAAAC,IAAA,CAAAJ,IAAA,GAAAD,MAAA;QAC/B,SAAAM,KAAA,GAAKL,IAAA,CAAApB,KAAA,CAAA0B,KAAa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[]}
@@ -1,43 +1,54 @@
1
1
  "use strict";
2
+
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: !0 });
10
- }, __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from == "object" || typeof from == "function")
12
- for (let key of __getOwnPropNames(from))
13
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- return to;
15
- };
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
16
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
23
  // If the importer is in node compatibility mode or this is not an ESM
18
24
  // file that has been converted to a CommonJS file using a Babel-
19
25
  // compatible transform (i.e. "__esModule" has not been set), then set
20
26
  // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
- mod
23
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
24
34
  var highlightWord_exports = {};
25
35
  __export(highlightWord_exports, {
26
36
  highlightWord: () => highlightWord
27
37
  });
28
38
  module.exports = __toCommonJS(highlightWord_exports);
29
- var import_hast_util_to_html = require("hast-util-to-html"), import_rehype_parse = __toESM(require("rehype-parse")), import_unified = require("unified"), CALLOUT = /__(.*?)__/g;
39
+ var import_hast_util_to_html = require("hast-util-to-html"),
40
+ import_rehype_parse = __toESM(require("rehype-parse")),
41
+ import_unified = require("unified"),
42
+ CALLOUT = /__(.*?)__/g;
30
43
  function highlightWord(code) {
31
- var html = (0, import_hast_util_to_html.toHtml)(code), result = html.replace(CALLOUT, function(_, text) {
32
- return `<span class="highlight-word">${text}</span>`;
33
- }), hast = (0, import_unified.unified)().use(import_rehype_parse.default, {
34
- emitParseErrors: !0,
35
- fragment: !0
36
- }).parse(result);
44
+ var html = (0, import_hast_util_to_html.toHtml)(code),
45
+ result = html.replace(CALLOUT, function (_, text) {
46
+ return `<span class="highlight-word">${text}</span>`;
47
+ }),
48
+ hast = (0, import_unified.unified)().use(import_rehype_parse.default, {
49
+ emitParseErrors: !0,
50
+ fragment: !0
51
+ }).parse(result);
37
52
  return hast.children;
38
53
  }
39
- // Annotate the CommonJS export names for ESM import in node:
40
- 0 && (module.exports = {
41
- highlightWord
42
- });
43
- //# sourceMappingURL=highlightWord.js.map
54
+ //# sourceMappingURL=highlightWord.native.js.map
@@ -1,6 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/highlightWord.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,+BAAuB,8BACvB,sBAAkB,kCAClB,iBAAwB,oBACpB,UAAU;AACP,SAAS,cAAc,MAAM;AAChC,MAAI,WAAO,iCAAO,IAAI,GAClB,SAAS,KAAK,QAAQ,SAAS,SAAS,GAAG,MAAM;AACjD,WAAO,gCAAgC,IAAI;AAAA,EAC/C,CAAC,GACG,WAAO,wBAAQ,EAAE,IAAI,oBAAAA,SAAO;AAAA,IAC5B,iBAAiB;AAAA,IACjB,UAAU;AAAA,EACd,CAAC,EAAE,MAAM,MAAM;AACf,SAAO,KAAK;AAChB;",
5
- "names": ["parse"]
6
- }
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","highlightWord_exports","__export","highlightWord","module","exports","import_hast_util_to_html","require","import_rehype_parse","__toESM","import_unified","CALLOUT","code","html","toHtml","result","replace","_","text","hast","unified","use","default","emitParseErrors","fragment","parse"],"sources":["../../src/highlightWord.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,qBAAA;AAAAC,QAAA,CAAAD,qBAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAT,YAAA,CAAAK,qBAAuB;AAIvB,IAAAK,wBAAgB,GAAAC,OAAA;EAAAC,mBAAA,GAAAC,OAAA,CAAAF,OAAA;EAAAG,cAAA,GAAAH,OAAA;EAAAI,OAAA;AAET,SAASR,cAAcS,IAAA,EAAM;EAElC,IAAAC,IAAM,OAAAP,wBADO,CAAAQ,MAAA,EAAAF,IAAO;IAAAG,MACA,GAAAF,IAAA,CAAAG,OAAA,CAAAL,OAAA,YAAAM,CAAA,EAAAC,IAAA;MAClB,uCAAAA,IAAA;IAAA,EACA;IAACC,IAAG,OAAST,cAAA,CAAAU,OAAA,IAAAC,GAAA,CAAAb,mBAAoC,CAAAc,OAAA;MACnDC,eAAA;MAIAC,QAAA,EAHa;IAIf,GAAAC,KAAA,CAAAV,MAAA","ignoreList":[]}
@@ -1,40 +1,53 @@
1
1
  "use strict";
2
+
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: !0 });
10
- }, __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from == "object" || typeof from == "function")
12
- for (let key of __getOwnPropNames(from))
13
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- return to;
15
- };
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
16
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
23
  // If the importer is in node compatibility mode or this is not an ESM
18
24
  // file that has been converted to a CommonJS file using a Babel-
19
25
  // compatible transform (i.e. "__esModule" has not been set), then set
20
26
  // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
- mod
23
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
24
34
  var index_exports = {};
25
35
  __export(index_exports, {
26
36
  codeToHTML: () => codeToHTML
27
37
  });
28
38
  module.exports = __toCommonJS(index_exports);
29
- var import_hast_util_to_html = require("hast-util-to-html"), import_parse_numeric_range = __toESM(require("parse-numeric-range")), import_refractor = require("refractor"), import_css = __toESM(require("refractor/lang/css")), import_tsx = __toESM(require("refractor/lang/tsx")), import_highlightLine = require("./highlightLine"), import_highlightWord = require("./highlightWord");
39
+ var import_hast_util_to_html = require("hast-util-to-html"),
40
+ import_parse_numeric_range = __toESM(require("parse-numeric-range")),
41
+ import_refractor = require("refractor"),
42
+ import_css = __toESM(require("refractor/lang/css")),
43
+ import_tsx = __toESM(require("refractor/lang/tsx")),
44
+ import_highlightLine = require("./highlightLine.native.js"),
45
+ import_highlightWord = require("./highlightWord.native.js");
30
46
  import_refractor.refractor.register(import_tsx.default);
31
47
  import_refractor.refractor.register(import_css.default);
32
48
  function codeToHTML(source, language) {
33
- var line = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "0", result = import_refractor.refractor.highlight(source, language);
49
+ var line = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "0",
50
+ result = import_refractor.refractor.highlight(source, language);
34
51
  return result = (0, import_highlightLine.highlightLine)(result, (0, import_parse_numeric_range.default)(line)), result = (0, import_highlightWord.highlightWord)(result), result = (0, import_hast_util_to_html.toHtml)(result), result;
35
52
  }
36
- // Annotate the CommonJS export names for ESM import in node:
37
- 0 && (module.exports = {
38
- codeToHTML
39
- });
40
- //# sourceMappingURL=index.js.map
53
+ //# sourceMappingURL=index.native.js.map
@@ -1,6 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAuB,8BACvB,6BAAwB,yCACxB,mBAA0B,sBAC1B,aAAgB,wCAChB,aAAgB,wCAChB,uBAA8B,4BAC9B,uBAA8B;AAC9B,2BAAU,SAAS,WAAAA,OAAG;AACtB,2BAAU,SAAS,WAAAC,OAAG;AACf,SAAS,WAAW,QAAQ,UAAU;AACzC,MAAI,OAAO,UAAU,SAAS,KAAK,UAAU,CAAC,MAAM,SAAS,UAAU,CAAC,IAAI,KACxE,SAAS,2BAAU,UAAU,QAAQ,QAAQ;AACjD,sBAAS,oCAAc,YAAQ,2BAAAC,SAAY,IAAI,CAAC,GAChD,aAAS,oCAAc,MAAM,GAC7B,aAAS,iCAAO,MAAM,GACf;AACX;",
5
- "names": ["tsx", "css", "rangeParser"]
6
- }
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","codeToHTML","module","exports","import_hast_util_to_html","require","import_parse_numeric_range","__toESM","import_refractor","import_css","import_tsx","import_highlightLine","import_highlightWord","refractor","register","default","source","language","line","arguments","length","result","highlight","highlightLine","highlightWord","toHtml"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,UAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAA,CAAAK,aAAuB;AASvB,IAAAK,wBAAU,GAAAC,OAAS,oBAAG;EAAAC,0BAAA,GAAAC,OAAA,CAAAF,OAAA;EAAAG,gBAAA,GAAAH,OAAA;EAAAI,UAAA,GAAAF,OAAA,CAAAF,OAAA;EAAAK,UAAA,GAAAH,OAAA,CAAAF,OAAA;EAAAM,oBAAA,GAAAN,OAAA;EAAAO,oBAAA,GAAAP,OAAA;AACtBG,gBAAA,CAAAK,SAAA,CAAUC,QAAA,CAASJ,UAAA,CAAAK,OAAG;AAEfP,gBAAS,CAAAK,SAAW,CAAAC,QAAgB,CAAAL,UAAyC,CAAAM,OAAK;AACvF,SAAId,UAAcA,CAAAe,MAAA,EAAAC,QAAA;EAClB,IAAAC,IAAA,GAAAC,SAAS,CAAAC,MAAA,QAAAD,SAAA,aAAc,IAAAA,SAAQ;IAAAE,MAAA,GAAAb,gBAAY,CAAAK,SAC3C,CAAAS,SAAS,CAAAN,MAAA,EAAAC,QAAA;EAGX,OAAAI,MAAA,OAAAV,oBAAA,CAAAY,aAAA,EAAAF,MAAA,MAAAf,0BAAA,CAAAS,OAAA,EAAAG,IAAA,IAAAG,MAAA,OAAAT,oBAAA,CAAAY,aAAA,EAAAH,MAAA,GAAAA,MAAA,OAAAjB,wBAAA,CAAAqB,MAAA,EAAAJ,MAAA,GAAAA,MAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/code-to-html",
3
- "version": "1.135.4",
3
+ "version": "1.135.6",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs",
@@ -30,7 +30,7 @@
30
30
  "url": "^0.11.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@tamagui/build": "1.135.4"
33
+ "@tamagui/build": "1.135.6"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"