@tamagui/code-to-html 1.63.0 → 1.64.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/code-to-html",
3
- "version": "1.63.0",
3
+ "version": "1.64.0",
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.63.0"
33
+ "@tamagui/build": "1.64.0"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
@@ -1,102 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
-
24
- // src/highlightLine.ts
25
- var highlightLine_exports = {};
26
- __export(highlightLine_exports, {
27
- highlightLine: () => highlightLine
28
- });
29
- module.exports = __toCommonJS(highlightLine_exports);
30
- 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, lineNum = 1) {
31
- let lineNumber = lineNum;
32
- return ast.reduce(
33
- (result, node) => {
34
- if (node.type === "text") {
35
- if (node.value.indexOf(`
36
- `) === -1)
37
- return node.lineNumber = lineNumber, result.nodes.push(node), result;
38
- let lines = node.value.split(`
39
- `);
40
- for (let i = 0; i < lines.length; i++)
41
- i !== 0 && ++lineNumber, !(i === lines.length - 1 && lines[i].length === 0) && result.nodes.push({
42
- type: "text",
43
- value: i === lines.length - 1 ? lines[i] : `${lines[i]}
44
- `,
45
- lineNumber
46
- });
47
- return result.lineNumber = lineNumber, result;
48
- }
49
- if (node.children) {
50
- node.lineNumber = lineNumber;
51
- let processed = lineNumberify2(node.children, lineNumber);
52
- return node.children = processed.nodes, result.lineNumber = processed.lineNumber, result.nodes.push(node), result;
53
- }
54
- return result.nodes.push(node), result;
55
- },
56
- { nodes: [], lineNumber }
57
- );
58
- }, wrapLines = function(ast, linesToHighlight) {
59
- let highlightAll = linesToHighlight.length === 1 && linesToHighlight[0] === 0, allLines = Array.from(new Set(ast.map((x) => x.lineNumber))), i = 0;
60
- return allLines.reduce((nodes, marker) => {
61
- let line = marker, children = [];
62
- for (; i < ast.length; i++) {
63
- if (ast[i].lineNumber < line) {
64
- nodes.push(ast[i]);
65
- continue;
66
- }
67
- if (ast[i].lineNumber === line) {
68
- children.push(ast[i]);
69
- continue;
70
- }
71
- if (ast[i].lineNumber > line)
72
- break;
73
- }
74
- return nodes.push({
75
- type: "element",
76
- tagName: "div",
77
- properties: {
78
- dataLine: line,
79
- className: "highlight-line",
80
- dataHighlighted: linesToHighlight.includes(line) || highlightAll ? "true" : "false"
81
- },
82
- children,
83
- lineNumber: line
84
- }), nodes;
85
- }, []);
86
- }, MULTILINE_TOKEN_SPAN = /<span class="token ([^"]+)">[^<]*\n[^<]*<\/span>/g, applyMultilineFix = function(ast) {
87
- let html = (0, import_hast_util_to_html.toHtml)(ast);
88
- return html = html.replace(
89
- MULTILINE_TOKEN_SPAN,
90
- (match, token) => match.replace(/\n/g, `</span>
91
- <span class="token ${token}">`)
92
- ), (0, import_unified.unified)().use(import_rehype_parse.default, { emitParseErrors: !0, fragment: !0 }).parse(html).children;
93
- };
94
- function highlightLine(ast, lines) {
95
- let formattedAst = applyMultilineFix(ast), numbered = lineNumberify(formattedAst).nodes;
96
- return wrapLines(numbered, lines);
97
- }
98
- // Annotate the CommonJS export names for ESM import in node:
99
- 0 && (module.exports = {
100
- highlightLine
101
- });
102
- //# sourceMappingURL=highlightLine.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/highlightLine.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,+BAAuB,8BACvB,sBAAkB,kCAClB,iBAAwB,oBAElB,gBAAgB,SAASA,eAAc,KAAK,UAAU,GAAG;AAC7D,MAAI,aAAa;AACjB,SAAO,IAAI;AAAA,IACT,CAAC,QAAQ,SAAS;AAChB,UAAI,KAAK,SAAS,QAAQ;AACxB,YAAI,KAAK,MAAM,QAAQ;AAAA,CAAI,MAAM;AAC/B,sBAAK,aAAa,YAClB,OAAO,MAAM,KAAK,IAAI,GACf;AAGT,YAAM,QAAQ,KAAK,MAAM,MAAM;AAAA,CAAI;AACnC,iBAAS,IAAI,GAAG,IAAI,MAAM,QAAQ;AAEhC,UADI,MAAM,KAAG,EAAE,YACX,QAAM,MAAM,SAAS,KAAK,MAAM,CAAC,EAAE,WAAW,MAClD,OAAO,MAAM,KAAK;AAAA,YAChB,MAAM;AAAA,YACN,OAAO,MAAM,MAAM,SAAS,IAAI,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC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,MAAI,WAAO,iCAAO,GAAG;AAGrB,gBAAO,KAAK;AAAA,IAAQ;AAAA,IAAsB,CAAC,OAAO,UAChD,MAAM,QAAQ,OAAO;AAAA,qBAA+B,KAAK,IAAI;AAAA,EAC/D,OAGa,wBAAQ,EAAE,IAAI,oBAAAC,SAAO,EAAE,iBAAiB,IAAM,UAAU,GAAK,CAAC,EAAE,MAAM,IAAI,EAE3E;AACd;AAEO,SAAS,cAAc,KAAK,OAAO;AACxC,MAAM,eAAe,kBAAkB,GAAG,GACpC,WAAW,cAAc,YAAY,EAAE;AAC7C,SAAO,UAAU,UAAU,KAAK;AAClC;",
5
- "names": ["lineNumberify", "parse"]
6
- }
@@ -1,103 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
- 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
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "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);
24
-
25
- // src/highlightLine.ts
26
- var highlightLine_exports = {};
27
- __export(highlightLine_exports, {
28
- highlightLine: () => highlightLine
29
- });
30
- module.exports = __toCommonJS(highlightLine_exports);
31
- 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, lineNum = 1) {
32
- let lineNumber = lineNum;
33
- return ast.reduce(
34
- (result, node) => {
35
- if (node.type === "text") {
36
- if (node.value.indexOf(`
37
- `) === -1)
38
- return node.lineNumber = lineNumber, result.nodes.push(node), result;
39
- let lines = node.value.split(`
40
- `);
41
- for (let i = 0; i < lines.length; i++)
42
- i !== 0 && ++lineNumber, !(i === lines.length - 1 && lines[i].length === 0) && result.nodes.push({
43
- type: "text",
44
- value: i === lines.length - 1 ? lines[i] : `${lines[i]}
45
- `,
46
- lineNumber
47
- });
48
- return result.lineNumber = lineNumber, result;
49
- }
50
- if (node.children) {
51
- node.lineNumber = lineNumber;
52
- let processed = lineNumberify2(node.children, lineNumber);
53
- return node.children = processed.nodes, result.lineNumber = processed.lineNumber, result.nodes.push(node), result;
54
- }
55
- return result.nodes.push(node), result;
56
- },
57
- { nodes: [], lineNumber }
58
- );
59
- }, wrapLines = function(ast, linesToHighlight) {
60
- let highlightAll = linesToHighlight.length === 1 && linesToHighlight[0] === 0, allLines = Array.from(new Set(ast.map((x) => x.lineNumber))), i = 0;
61
- return allLines.reduce((nodes, marker) => {
62
- let line = marker, children = [];
63
- for (; i < ast.length; i++) {
64
- if (ast[i].lineNumber < line) {
65
- nodes.push(ast[i]);
66
- continue;
67
- }
68
- if (ast[i].lineNumber === line) {
69
- children.push(ast[i]);
70
- continue;
71
- }
72
- if (ast[i].lineNumber > line)
73
- break;
74
- }
75
- return nodes.push({
76
- type: "element",
77
- tagName: "div",
78
- properties: {
79
- dataLine: line,
80
- className: "highlight-line",
81
- dataHighlighted: linesToHighlight.includes(line) || highlightAll ? "true" : "false"
82
- },
83
- children,
84
- lineNumber: line
85
- }), nodes;
86
- }, []);
87
- }, MULTILINE_TOKEN_SPAN = /<span class="token ([^"]+)">[^<]*\n[^<]*<\/span>/g, applyMultilineFix = function(ast) {
88
- let html = (0, import_hast_util_to_html.toHtml)(ast);
89
- return html = html.replace(
90
- MULTILINE_TOKEN_SPAN,
91
- (match, token) => match.replace(/\n/g, `</span>
92
- <span class="token ${token}">`)
93
- ), (0, import_unified.unified)().use(import_rehype_parse.default, { emitParseErrors: !0, fragment: !0 }).parse(html).children;
94
- };
95
- function highlightLine(ast, lines) {
96
- let formattedAst = applyMultilineFix(ast), numbered = lineNumberify(formattedAst).nodes;
97
- return wrapLines(numbered, lines);
98
- }
99
- // Annotate the CommonJS export names for ESM import in node:
100
- 0 && (module.exports = {
101
- highlightLine
102
- });
103
- //# sourceMappingURL=highlightLine.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/highlightLine.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,+BAAuB,8BACvB,sBAAkB,kCAClB,iBAAwB,oBAElB,gBAAgB,SAASA,eAAc,KAAK,UAAU,GAAG;AAC7D,MAAI,aAAa;AACjB,SAAO,IAAI;AAAA,IACT,CAAC,QAAQ,SAAS;AAChB,UAAI,KAAK,SAAS,QAAQ;AACxB,YAAI,KAAK,MAAM,QAAQ;AAAA,CAAI,MAAM;AAC/B,sBAAK,aAAa,YAClB,OAAO,MAAM,KAAK,IAAI,GACf;AAGT,YAAM,QAAQ,KAAK,MAAM,MAAM;AAAA,CAAI;AACnC,iBAAS,IAAI,GAAG,IAAI,MAAM,QAAQ;AAEhC,UADI,MAAM,KAAG,EAAE,YACX,QAAM,MAAM,SAAS,KAAK,MAAM,CAAC,EAAE,WAAW,MAClD,OAAO,MAAM,KAAK;AAAA,YAChB,MAAM;AAAA,YACN,OAAO,MAAM,MAAM,SAAS,IAAI,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC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,MAAI,WAAO,iCAAO,GAAG;AAGrB,gBAAO,KAAK;AAAA,IAAQ;AAAA,IAAsB,CAAC,OAAO,UAChD,MAAM,QAAQ,OAAO;AAAA,qBAA+B,KAAK,IAAI;AAAA,EAC/D,OAGa,wBAAQ,EAAE,IAAI,oBAAAC,SAAO,EAAE,iBAAiB,IAAM,UAAU,GAAK,CAAC,EAAE,MAAM,IAAI,EAE3E;AACd;AAEO,SAAS,cAAc,KAAK,OAAO;AACxC,MAAM,eAAe,kBAAkB,GAAG,GACpC,WAAW,cAAc,YAAY,EAAE;AAC7C,SAAO,UAAU,UAAU,KAAK;AAClC;",
5
- "names": ["lineNumberify", "parse"]
6
- }
@@ -1,42 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
-
24
- // src/highlightWord.ts
25
- var highlightWord_exports = {};
26
- __export(highlightWord_exports, {
27
- highlightWord: () => highlightWord
28
- });
29
- module.exports = __toCommonJS(highlightWord_exports);
30
- var import_hast_util_to_html = require("hast-util-to-html"), import_rehype_parse = __toESM(require("rehype-parse")), import_unified = require("unified"), CALLOUT = /__(.*?)__/g;
31
- function highlightWord(code) {
32
- let result = (0, import_hast_util_to_html.toHtml)(code).replace(
33
- CALLOUT,
34
- (_, text) => `<span class="highlight-word">${text}</span>`
35
- );
36
- return (0, import_unified.unified)().use(import_rehype_parse.default, { emitParseErrors: !0, fragment: !0 }).parse(result).children;
37
- }
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- highlightWord
41
- });
42
- //# sourceMappingURL=highlightWord.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/highlightWord.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,+BAAuB,8BACvB,sBAAkB,kCAClB,iBAAwB,oBAElB,UAAU;AAET,SAAS,cAAc,MAAM;AAElC,MAAM,aADO,iCAAO,IAAI,EACJ;AAAA,IAClB;AAAA,IACA,CAAC,GAAG,SAAS,gCAAgC,IAAI;AAAA,EACnD;AAIA,aAHa,wBAAQ,EAClB,IAAI,oBAAAA,SAAO,EAAE,iBAAiB,IAAM,UAAU,GAAK,CAAC,EACpD,MAAM,MAAM,EACH;AACd;",
5
- "names": ["parse"]
6
- }
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
- 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
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "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);
24
-
25
- // src/highlightWord.ts
26
- var highlightWord_exports = {};
27
- __export(highlightWord_exports, {
28
- highlightWord: () => highlightWord
29
- });
30
- module.exports = __toCommonJS(highlightWord_exports);
31
- var import_hast_util_to_html = require("hast-util-to-html"), import_rehype_parse = __toESM(require("rehype-parse")), import_unified = require("unified"), CALLOUT = /__(.*?)__/g;
32
- function highlightWord(code) {
33
- let result = (0, import_hast_util_to_html.toHtml)(code).replace(
34
- CALLOUT,
35
- (_, text) => `<span class="highlight-word">${text}</span>`
36
- );
37
- return (0, import_unified.unified)().use(import_rehype_parse.default, { emitParseErrors: !0, fragment: !0 }).parse(result).children;
38
- }
39
- // Annotate the CommonJS export names for ESM import in node:
40
- 0 && (module.exports = {
41
- highlightWord
42
- });
43
- //# sourceMappingURL=highlightWord.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/highlightWord.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,+BAAuB,8BACvB,sBAAkB,kCAClB,iBAAwB,oBAElB,UAAU;AAET,SAAS,cAAc,MAAM;AAElC,MAAM,aADO,iCAAO,IAAI,EACJ;AAAA,IAClB;AAAA,IACA,CAAC,GAAG,SAAS,gCAAgC,IAAI;AAAA,EACnD;AAIA,aAHa,wBAAQ,EAClB,IAAI,oBAAAA,SAAO,EAAE,iBAAiB,IAAM,UAAU,GAAK,CAAC,EACpD,MAAM,MAAM,EACH;AACd;",
5
- "names": ["parse"]
6
- }