@tenzir/codemirror-lang-tql 0.4.7 → 0.5.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
@@ -7,37 +7,57 @@
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
10
- "version": "0.4.7",
11
- "description": "Tenzir Query Language (TQL) support for CodeMirror",
10
+ "version": "0.5.0",
11
+ "description": "Tenzir Query Language (TQL) support for CodeMirror, backed by tree-sitter-tql",
12
+ "keywords": [
13
+ "codemirror",
14
+ "tql",
15
+ "tenzir",
16
+ "tree-sitter"
17
+ ],
18
+ "files": [
19
+ "dist"
20
+ ],
12
21
  "scripts": {
13
- "build": "lezer-generator src/tql.grammar -o src/parser && rollup -c",
14
- "build-debug": "lezer-generator src/tql.grammar --names -o src/parser && rollup -c",
15
- "test": "mocha test/test.js"
22
+ "build": "rollup -c",
23
+ "test": "node --test test/*.test.js && tsc -p test/types"
16
24
  },
17
25
  "type": "module",
18
26
  "main": "dist/index.cjs",
19
27
  "module": "dist/index.js",
28
+ "types": "dist/index.d.ts",
20
29
  "exports": {
21
30
  "import": "./dist/index.js",
22
31
  "require": "./dist/index.cjs"
23
32
  },
24
- "types": "dist/index.d.ts",
25
33
  "sideEffects": false,
26
- "dependencies": {
27
- "@codemirror/autocomplete": "^6.6.0",
28
- "@codemirror/language": "^6.0.0",
29
- "@lezer/highlight": "^1.1.6",
30
- "@lezer/lr": "^1.3.0",
31
- "hastscript": "^8.0.0",
32
- "unist-util-visit": "^5.0.0"
34
+ "peerDependencies": {
35
+ "@codemirror/language": "^6.10.0",
36
+ "@lezer/common": "^1.2.0",
37
+ "@lezer/highlight": "^1.2.0",
38
+ "web-tree-sitter": "^0.26.11"
33
39
  },
34
40
  "devDependencies": {
35
- "@lezer/generator": "^1.3.0",
36
- "mocha": "^9.0.1",
37
- "rollup": "^2.60.2",
38
- "rollup-plugin-dts": "^4.0.1",
39
- "rollup-plugin-ts": "^3.0.2",
40
- "typescript": "^4.3.4"
41
+ "@codemirror/autocomplete": "^6.20.4",
42
+ "@codemirror/commands": "^6.11.1",
43
+ "@codemirror/lang-yaml": "^6.1.3",
44
+ "@codemirror/language": "^6.13.1",
45
+ "@codemirror/state": "^6.7.6",
46
+ "@codemirror/view": "^6.43.15",
47
+ "@lezer/common": "^1.5.5",
48
+ "@lezer/highlight": "^1.2.5",
49
+ "@rollup/plugin-typescript": "^12.3.1",
50
+ "rollup": "^4.68.2",
51
+ "rollup-plugin-dts": "^6.5.1",
52
+ "tree-sitter-tql": "1.3.0",
53
+ "tslib": "^2.9.1",
54
+ "typescript": "^5.9.3",
55
+ "web-tree-sitter": "^0.26.13"
56
+ },
57
+ "pnpm": {
58
+ "overrides": {
59
+ "picomatch": "4.0.4"
60
+ }
41
61
  },
42
62
  "license": "MIT",
43
63
  "packageManager": "pnpm@9.8.0+sha512.8e4c3550fb500e808dbc30bb0ce4dd1eb614e30b1c55245f211591ec2cdf9c611cabd34e1364b42f564bd54b3945ed0f49d61d1bbf2ec9bd74b866fcdc723276"
@@ -1,31 +0,0 @@
1
- name: Publish Every Commit
2
- on:
3
- push:
4
- branches:
5
- - main
6
- pull_request:
7
- types:
8
- - opened
9
- - synchronize
10
-
11
- jobs:
12
- build:
13
- runs-on: ubuntu-latest
14
-
15
- steps:
16
- - name: Checkout code
17
- uses: actions/checkout@v4
18
-
19
- - run: corepack enable
20
- - uses: actions/setup-node@v4
21
- with:
22
- node-version: 20
23
- cache: "pnpm"
24
-
25
- - name: Install dependencies
26
- run: pnpm install
27
-
28
- - name: Build
29
- run: pnpm build
30
-
31
- - run: pnpx pkg-pr-new publish
@@ -1,28 +0,0 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
-
4
- name: Node.js Package
5
-
6
- on:
7
- workflow_dispatch:
8
- release:
9
- types: [created]
10
-
11
- jobs:
12
- publish-gpr:
13
- runs-on: ubuntu-latest
14
- permissions:
15
- contents: read
16
- packages: write
17
- steps:
18
- - uses: actions/checkout@v3
19
- - uses: actions/setup-node@v3
20
- with:
21
- node-version: 18
22
- registry-url: https://npm.pkg.github.com/
23
- - run: corepack enable
24
- - run: pnpm install
25
- - run: pnpm build
26
- - run: pnpm publish
27
- env:
28
- NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -1,22 +0,0 @@
1
- name: Publish to NPM
2
-
3
- on:
4
- workflow_dispatch:
5
- release:
6
- types: [created]
7
-
8
- jobs:
9
- publish:
10
- runs-on: ubuntu-latest
11
- steps:
12
- - uses: actions/checkout@v4
13
- - uses: actions/setup-node@v3
14
- with:
15
- node-version: "20"
16
- - run: corepack enable
17
- - run: pnpm install
18
- - run: pnpm build
19
-
20
- - uses: JS-DevTools/npm-publish@v3
21
- with:
22
- token: ${{ secrets.NPM_TOKEN }}
package/scripts/index.js DELETED
@@ -1,123 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import rehypeStringify from "rehype-stringify";
4
- import remarkParse from "remark-parse";
5
- import remarkRehype from "remark-rehype";
6
- import strip from "strip-markdown";
7
- import { remark } from "remark";
8
- import { unified } from "unified";
9
- import { promisify } from "util";
10
- import remarkFlexibleContainers from "remark-flexible-containers";
11
-
12
- const readFile = promisify(fs.readFile);
13
- const readDirectory = promisify(fs.readdir);
14
- const writeFile = promisify(fs.writeFile);
15
- const lstat = promisify(fs.lstat);
16
-
17
- const infoProcessor = unified()
18
- .use(remarkParse)
19
- .use(remarkFlexibleContainers)
20
- .use(remarkRehype, { allowDangerousHtml: true })
21
- .use(rehypeStringify);
22
-
23
- const detailProcessor = remark().use(strip);
24
-
25
- let output = [];
26
-
27
- const processFile = async (filePath) => {
28
- try {
29
- const data = await readFile(filePath, "utf8");
30
- let lines = data.split("\n");
31
- let detail = undefined;
32
- let infoArr = [];
33
-
34
- let i = 0;
35
- while (i < lines.length) {
36
- if (lines[i].startsWith("---")) {
37
- i++;
38
- while (!lines[i].startsWith("---")) {
39
- i++;
40
- }
41
- i++;
42
- } else if (lines[i].trim() === "" || lines[i].startsWith("#")) {
43
- i++;
44
- } else {
45
- break;
46
- }
47
- }
48
- while (i < lines.length) {
49
- if (detail == undefined && lines[i].trim() !== "") {
50
- detail = lines[i];
51
- } else if (detail != null) {
52
- infoArr.push(lines[i]);
53
- }
54
- i++;
55
- }
56
- let info = infoArr.join("\n");
57
-
58
- // get relative path to docs from filePath
59
- const docRoute = filePath.split("docs")[1].split(".md")[0];
60
- const docLink = `https://docs.tenzir.com${docRoute}`;
61
-
62
- const infoFile = await infoProcessor.process(info);
63
-
64
- const detailFile = await detailProcessor.process(detail);
65
-
66
- output.push({
67
- label: path.basename(filePath, ".md"),
68
- type: "keyword",
69
- detail: String(detailFile).trim(), // remove trailing whitespace
70
- processedHTML: String(infoFile),
71
- docLink,
72
- });
73
- } catch (err) {
74
- console.error(err);
75
- }
76
- };
77
-
78
- const processDirectory = async (directoryPath, outputPath) => {
79
- try {
80
- const files = await readDirectory(directoryPath);
81
- for (let file of files) {
82
- file = path.resolve(directoryPath, file);
83
-
84
- // Also ignore README.md files
85
- if (path.basename(file) === "README.md") {
86
- continue;
87
- }
88
-
89
- // ignore files that are not inside sources, transformations, or sinks subdirectories
90
- // TODO: this is a hacky way to do this, but it works for now
91
- if (
92
- !file.includes("/operators/")
93
- ) {
94
- continue;
95
- }
96
-
97
- const stat = await lstat(file);
98
-
99
- if (stat.isDirectory()) {
100
- await processDirectory(file, outputPath);
101
- } else if (path.extname(file) === ".md") {
102
- await processFile(file);
103
- }
104
- }
105
-
106
- await writeFile(
107
- outputPath,
108
- `export const data = ${JSON.stringify(output, undefined, 2)};`,
109
- "utf8",
110
- );
111
- } catch (err) {
112
- console.error(err);
113
- }
114
- };
115
-
116
- const directoryPath = process.argv[2];
117
- const outputPath = process.argv[3];
118
-
119
- if (directoryPath && outputPath) {
120
- processDirectory(directoryPath, outputPath);
121
- } else {
122
- console.log("Usage: node index.js <directoryPath> <outputFile.js>");
123
- }
@@ -1,26 +0,0 @@
1
- {
2
- "name": "scripts",
3
- "version": "1.0.0",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "keywords": [],
10
- "author": "",
11
- "license": "ISC",
12
- "type": "module",
13
- "dependencies": {
14
- "rehype-document": "^6.1.0",
15
- "rehype-format": "^4.0.1",
16
- "rehype-stringify": "^9.0.3",
17
- "remark": "^14.0.3",
18
- "remark-flexible-containers": "^1.0.6",
19
- "remark-parse": "^10.0.2",
20
- "remark-rehype": "^10.1.0",
21
- "strip-markdown": "^5.0.1",
22
- "to-vfile": "^8.0.0",
23
- "unified": "^10.1.2",
24
- "vfile-reporter": "^8.0.0"
25
- }
26
- }