@tamagui/code-to-html 1.74.13 → 1.74.14

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.74.13",
3
+ "version": "1.74.14",
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.74.13"
33
+ "@tamagui/build": "1.74.14"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
@@ -1,134 +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;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/highlightLine.ts
31
- var highlightLine_exports = {};
32
- __export(highlightLine_exports, {
33
- highlightLine: () => highlightLine
34
- });
35
- module.exports = __toCommonJS(highlightLine_exports);
36
- var import_hast_util_to_html = require("hast-util-to-html");
37
- var import_rehype_parse = __toESM(require("rehype-parse"));
38
- var import_unified = require("unified");
39
- var lineNumberify = function lineNumberify2(ast, lineNum = 1) {
40
- let lineNumber = lineNum;
41
- return ast.reduce(
42
- (result, node) => {
43
- if (node.type === "text") {
44
- if (node.value.indexOf("\n") === -1) {
45
- node.lineNumber = lineNumber;
46
- result.nodes.push(node);
47
- return result;
48
- }
49
- const lines = node.value.split("\n");
50
- for (let i = 0; i < lines.length; i++) {
51
- if (i !== 0)
52
- ++lineNumber;
53
- if (i === lines.length - 1 && lines[i].length === 0)
54
- continue;
55
- result.nodes.push({
56
- type: "text",
57
- value: i === lines.length - 1 ? lines[i] : `${lines[i]}
58
- `,
59
- lineNumber
60
- });
61
- }
62
- result.lineNumber = lineNumber;
63
- return result;
64
- }
65
- if (node.children) {
66
- node.lineNumber = lineNumber;
67
- const processed = lineNumberify2(node.children, lineNumber);
68
- node.children = processed.nodes;
69
- result.lineNumber = processed.lineNumber;
70
- result.nodes.push(node);
71
- return result;
72
- }
73
- result.nodes.push(node);
74
- return result;
75
- },
76
- { nodes: [], lineNumber }
77
- );
78
- };
79
- var wrapLines = function wrapLines2(ast, linesToHighlight) {
80
- const highlightAll = linesToHighlight.length === 1 && linesToHighlight[0] === 0;
81
- const allLines = Array.from(new Set(ast.map((x) => x.lineNumber)));
82
- let i = 0;
83
- const wrapped = allLines.reduce((nodes, marker) => {
84
- const line = marker;
85
- const children = [];
86
- for (; i < ast.length; i++) {
87
- if (ast[i].lineNumber < line) {
88
- nodes.push(ast[i]);
89
- continue;
90
- }
91
- if (ast[i].lineNumber === line) {
92
- children.push(ast[i]);
93
- continue;
94
- }
95
- if (ast[i].lineNumber > line) {
96
- break;
97
- }
98
- }
99
- nodes.push({
100
- type: "element",
101
- tagName: "div",
102
- properties: {
103
- dataLine: line,
104
- className: "highlight-line",
105
- dataHighlighted: linesToHighlight.includes(line) || highlightAll ? "true" : "false"
106
- },
107
- children,
108
- lineNumber: line
109
- });
110
- return nodes;
111
- }, []);
112
- return wrapped;
113
- };
114
- var MULTILINE_TOKEN_SPAN = /<span class="token ([^"]+)">[^<]*\n[^<]*<\/span>/g;
115
- var applyMultilineFix = function(ast) {
116
- let html = (0, import_hast_util_to_html.toHtml)(ast);
117
- html = html.replace(
118
- MULTILINE_TOKEN_SPAN,
119
- (match, token) => match.replace(/\n/g, `</span>
120
- <span class="token ${token}">`)
121
- );
122
- const hast = (0, import_unified.unified)().use(import_rehype_parse.default, { emitParseErrors: true, fragment: true }).parse(html);
123
- return hast.children;
124
- };
125
- function highlightLine(ast, lines) {
126
- const formattedAst = applyMultilineFix(ast);
127
- const numbered = lineNumberify(formattedAst).nodes;
128
- return wrapLines(numbered, lines);
129
- }
130
- // Annotate the CommonJS export names for ESM import in node:
131
- 0 && (module.exports = {
132
- highlightLine
133
- });
134
- //# 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;AACvB,0BAAkB;AAClB,qBAAwB;AAExB,IAAM,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,IAAI,MAAM,IAAI;AACnC,eAAK,aAAa;AAClB,iBAAO,MAAM,KAAK,IAAI;AACtB,iBAAO;AAAA,QACT;AAEA,cAAM,QAAQ,KAAK,MAAM,MAAM,IAAI;AACnC,iBAAS,IAAI,GAA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AAAA,IACF;AAEA,UAAM,KAAK;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,YAAY;AAAA,QACV,UAAU;AAAA,QACV,WAAW;AAAA,QACX,iBACE,iBAAiB,SAAS,IAAI,KAAK,eAAe,SAAS;AAAA,MAC/D;AAAA,MACA;AAAA,MACA,YAAY;AAAA,IACd,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;AAGA,IAAM,uBAAuB;AAE7B,IAAM,oBAAoB,SAAU,KAAK;AAEvC,MAAI,WAAO,iCAAO,GAAG;AAGrB,SAAO,KAAK;AAAA,IAAQ;AAAA,IAAsB,CAAC,OAAO,UAChD,MAAM,QAAQ,OAAO;AAAA,qBAA+B,KAAK,IAAI;AAAA,EAC/D;AAGA,QAAM,WAAO,wBAAQ,EAAE,IAAI,oBAAAC,SAAO,EAAE,iBAAiB,MAAM,UAAU,KAAK,CAAC,EAAE,MAAM,IAAI;AAEvF,SAAO,KAAK;AACd;AAEO,SAAS,cAAc,KAAK,OAAO;AACxC,QAAM,eAAe,kBAAkB,GAAG;AAC1C,QAAM,WAAW,cAAc,YAAY,EAAE;AAC7C,SAAO,UAAU,UAAU,KAAK;AAClC;",
5
- "names": ["lineNumberify", "wrapLines", "parse"]
6
- }
@@ -1,53 +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;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/highlightWord.ts
31
- var highlightWord_exports = {};
32
- __export(highlightWord_exports, {
33
- highlightWord: () => highlightWord
34
- });
35
- module.exports = __toCommonJS(highlightWord_exports);
36
- var import_hast_util_to_html = require("hast-util-to-html");
37
- var import_rehype_parse = __toESM(require("rehype-parse"));
38
- var import_unified = require("unified");
39
- var CALLOUT = /__(.*?)__/g;
40
- function highlightWord(code) {
41
- const html = (0, import_hast_util_to_html.toHtml)(code);
42
- const result = html.replace(
43
- CALLOUT,
44
- (_, text) => `<span class="highlight-word">${text}</span>`
45
- );
46
- const hast = (0, import_unified.unified)().use(import_rehype_parse.default, { emitParseErrors: true, fragment: true }).parse(result);
47
- return hast.children;
48
- }
49
- // Annotate the CommonJS export names for ESM import in node:
50
- 0 && (module.exports = {
51
- highlightWord
52
- });
53
- //# 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;AACvB,0BAAkB;AAClB,qBAAwB;AAExB,IAAM,UAAU;AAET,SAAS,cAAc,MAAM;AAClC,QAAM,WAAO,iCAAO,IAAI;AACxB,QAAM,SAAS,KAAK;AAAA,IAClB;AAAA,IACA,CAAC,GAAG,SAAS,gCAAgC,IAAI;AAAA,EACnD;AACA,QAAM,WAAO,wBAAQ,EAClB,IAAI,oBAAAA,SAAO,EAAE,iBAAiB,MAAM,UAAU,KAAK,CAAC,EACpD,MAAM,MAAM;AACf,SAAO,KAAK;AACd;",
5
- "names": ["parse"]
6
- }