@lumis-sh/wasm-dart 0.26.3 → 0.26.4

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 CHANGED
@@ -1,22 +1,52 @@
1
1
  # @lumis-sh/wasm-dart
2
2
 
3
- Self-contained Lumis language package for dart, with its parser and queries.
3
+ Self-contained Lumis language package for dart.
4
+
5
+ The Tree-sitter parser is compiled to WASM and ships with the queries that highlight it.
4
6
 
5
7
  Built with [`tree-sitter build --wasm`](https://tree-sitter.github.io/tree-sitter/cli/build.html) `v0.26.11`
6
8
 
7
9
  Used by [Lumis](https://lumis.sh) and compatible with [web-tree-sitter](https://www.npmjs.com/package/web-tree-sitter) v0.26 and other WASM runtimes.
8
10
 
11
+ ## Installation
12
+
13
+ ```sh
14
+ npm install @lumis-sh/wasm-dart
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ The package exports the language, ready for Lumis, in Node and in a browser:
20
+
21
+ ```js
22
+ import { createHighlighter } from '@lumis-sh/lumis'
23
+ import dart from '@lumis-sh/wasm-dart'
24
+
25
+ const highlighter = await createHighlighter({ languages: [dart] })
26
+ ```
27
+
28
+ ## What it contains
29
+
30
+ `tree-sitter-dart.wasm` is the parser. `lumis.json` describes it and records its size, its SHA-256 and the queries.
31
+
32
+ Node reads both from the installed package, and a bundler ships them with your code, so nothing is downloaded at runtime.
33
+
9
34
  ## Parser
10
35
 
11
36
  | Parser | Version | Rev |
12
37
  | ------ | ------- | --- |
13
38
  | [https://github.com/UserNobody14/tree-sitter-dart.git](https://github.com/UserNobody14/tree-sitter-dart.git) | 1.0.0 | be07cf7118d3dba06236a3f19541685a68209934 |
14
39
 
40
+ The same parser is published to Hex as
41
+ [`lumis_wasm_dart`](https://hex.pm/packages/lumis_wasm_dart) — byte for byte, from
42
+ one build, so both registries serve the same artifact.
43
+
15
44
  ## CDN
16
45
 
17
- - [https://unpkg.com/@lumis-sh/wasm-dart@0.26.3/tree-sitter-dart.wasm](https://unpkg.com/@lumis-sh/wasm-dart@0.26.3/tree-sitter-dart.wasm)
18
- - [https://cdn.jsdelivr.net/npm/@lumis-sh/wasm-dart@0.26.3/tree-sitter-dart.wasm](https://cdn.jsdelivr.net/npm/@lumis-sh/wasm-dart@0.26.3/tree-sitter-dart.wasm)
46
+ - [https://unpkg.com/@lumis-sh/wasm-dart@0.26.4/tree-sitter-dart.wasm](https://unpkg.com/@lumis-sh/wasm-dart@0.26.4/tree-sitter-dart.wasm)
47
+ - [https://cdn.jsdelivr.net/npm/@lumis-sh/wasm-dart@0.26.4/tree-sitter-dart.wasm](https://cdn.jsdelivr.net/npm/@lumis-sh/wasm-dart@0.26.4/tree-sitter-dart.wasm)
19
48
 
20
49
  ## License
21
50
 
22
- This package redistributes the parser source listed above; see that project for its license.
51
+ The Lumis packaging is MIT. The parser itself is redistributed from the
52
+ upstream project above; see that project for its license.
package/index.d.ts CHANGED
@@ -1,2 +1,25 @@
1
- declare const wasmUrl: URL
2
- export default wasmUrl
1
+ /**
2
+ * A language from this package. Pass it to `createHighlighter({ languages })`
3
+ * from `@lumis-sh/lumis`, in Node or in a browser.
4
+ */
5
+ export interface Language {
6
+ id: string
7
+ aliases: string[]
8
+ packageName: string
9
+ /** The parser, which a bundler ships next to your code. */
10
+ wasm: URL
11
+ languagePackage: LanguagePackage
12
+ /** Grammars this language cannot highlight without, loaded along with it. */
13
+ requires?: Language[]
14
+ }
15
+
16
+ /** This package's `lumis.json`: the parser's size and digest, and the queries released with it. */
17
+ export interface LanguagePackage {
18
+ packageName: string
19
+ version: string
20
+ [field: string]: unknown
21
+ }
22
+
23
+ export declare const languagePackage: LanguagePackage
24
+ export declare const dart: Language
25
+ export { dart as default }
package/index.js CHANGED
@@ -1,2 +1,34 @@
1
- const wasmUrl = new URL('./tree-sitter-dart.wasm', import.meta.url)
2
- export default wasmUrl
1
+ const wasm = new URL('./tree-sitter-dart.wasm', import.meta.url)
2
+
3
+ export const languagePackage = {
4
+ "packageName": "@lumis-sh/wasm-dart",
5
+ "version": "0.26.4",
6
+ "definitionHash": "fb831d8b6931dcb442d0623ff8a7b63123d24a1de0eab3833a2c1cd713958d12",
7
+ "parser": {
8
+ "name": "tree-sitter-dart",
9
+ "grammarName": "dart",
10
+ "upstreamVersion": "1.0.0",
11
+ "revision": "be07cf7118d3dba06236a3f19541685a68209934",
12
+ "sha256": "f743e6ecda0447cf330d012e9c8dc4f784d2a8874dbdec4b929b0dde87faec79",
13
+ "size": 1159597
14
+ },
15
+ "languages": {
16
+ "dart": {
17
+ "aliases": [],
18
+ "highlights": "; This file is auto-generated. Do not edit.\n(identifier) @variable\n\n(dotted_identifier_list) @string\n\n; Methods\n; --------------------\n; TODO: add method/call_expression to grammar and\n; distinguish method call from variable access\n(function_expression_body\n (identifier) @function.call)\n\n; ((identifier)(selector (argument_part)) @function)\n; NOTE: This query is a bit of a work around for the fact that the dart grammar doesn't\n; specifically identify a node as a function call\n(((identifier) @function.call\n (#match? @function.call \"^_?[a-z]\"))\n .\n (selector\n .\n (argument_part))) @function.call\n\n; Annotations\n; --------------------\n(annotation\n \"@\" @attribute\n name: (identifier) @attribute)\n\n; Operators and Tokens\n; --------------------\n(template_substitution\n \"$\" @punctuation.special\n \"{\" @punctuation.special\n \"}\" @punctuation.special) @none\n\n(template_substitution\n \"$\" @punctuation.special\n (identifier_dollar_escaped) @variable) @none\n\n(escape_sequence) @string.escape\n\n[\n \"=>\"\n \"..\"\n \"??\"\n \"==\"\n \"!\"\n \"?\"\n \"&&\"\n \"%\"\n \"<\"\n \">\"\n \"=\"\n \">=\"\n \"<=\"\n \"||\"\n \">>>=\"\n \">>=\"\n \"<<=\"\n \"&=\"\n \"|=\"\n \"??=\"\n \"%=\"\n \"+=\"\n \"-=\"\n \"*=\"\n \"/=\"\n \"^=\"\n \"~/=\"\n (shift_operator)\n (multiplicative_operator)\n (increment_operator)\n (is_operator)\n (prefix_operator)\n (equality_operator)\n (additive_operator)\n] @operator\n\n[\n \"(\"\n \")\"\n \"[\"\n \"]\"\n \"{\"\n \"}\"\n] @punctuation.bracket\n\n; Delimiters\n; --------------------\n[\n \";\"\n \".\"\n \",\"\n \":\"\n \"?.\"\n \"?\"\n] @punctuation.delimiter\n\n; Types\n; --------------------\n(class_definition\n name: (identifier) @type)\n\n(constructor_signature\n name: (identifier) @type)\n\n(scoped_identifier\n scope: (identifier) @type)\n\n(function_signature\n name: (identifier) @function.method)\n\n(getter_signature\n (identifier) @function.method)\n\n(setter_signature\n name: (identifier) @function.method)\n\n(enum_declaration\n name: (identifier) @type)\n\n(enum_constant\n name: (identifier) @type)\n\n(void_type) @type\n\n((scoped_identifier\n scope: (identifier) @type\n name: (identifier) @type)\n (#match? @type \"^[A-Za-z]\"))\n\n(type_identifier) @type\n\n(type_alias\n (type_identifier) @type.definition)\n\n(type_arguments\n [\n \"<\"\n \">\"\n ] @punctuation.bracket)\n\n; Variables\n; --------------------\n; var keyword\n(inferred_type) @keyword\n\n((identifier) @type\n (#match? @type \"^_?[A-Z][\\\\s\\\\S]*[a-z]\")) ; catch Classes or IClasses not CLASSES\n\n\"Function\" @type\n\n; properties\n(unconditional_assignable_selector\n (identifier) @property)\n\n(conditional_assignable_selector\n (identifier) @property)\n\n(this) @variable.builtin\n\n; Parameters\n; --------------------\n(formal_parameter\n (identifier) @variable.parameter)\n\n(named_argument\n (label\n (identifier) @variable.parameter))\n\n; Literals\n; --------------------\n[\n (hex_integer_literal)\n (decimal_integer_literal)\n (decimal_floating_point_literal)\n ; TODO: inaccessible nodes\n ; (octal_integer_literal)\n ; (hex_floating_point_literal)\n] @number\n\n(symbol_literal) @string.special.symbol\n\n(string_literal) @string\n\n(true) @boolean\n\n(false) @boolean\n\n(null_literal) @constant.builtin\n\n(comment) @comment \n\n(documentation_comment) @comment.documentation \n\n; Keywords\n; --------------------\n[\n \"import\"\n \"library\"\n \"export\"\n \"as\"\n \"show\"\n \"hide\"\n] @keyword.import\n\n; Reserved words (cannot be used as identifiers)\n[\n ; TODO:\n ; \"rethrow\" cannot be targeted at all and seems to be an invisible node\n ; TODO:\n ; the assert keyword cannot be specifically targeted\n ; because the grammar selects the whole node or the content\n ; of the assertion not just the keyword\n ; assert\n (case_builtin)\n \"late\"\n \"required\"\n \"on\"\n \"extends\"\n \"in\"\n \"is\"\n \"new\"\n \"super\"\n \"with\"\n] @keyword\n\n[\n \"class\"\n \"enum\"\n \"extension\"\n] @keyword.type\n\n\"return\" @keyword.return\n\n; Built in identifiers:\n; alone these are marked as keywords\n[\n \"deferred\"\n \"factory\"\n \"get\"\n \"implements\"\n \"interface\"\n \"library\"\n \"operator\"\n \"mixin\"\n \"part\"\n \"set\"\n \"typedef\"\n] @keyword\n\n[\n \"async\"\n \"async*\"\n \"sync*\"\n \"await\"\n \"yield\"\n] @keyword.coroutine\n\n[\n (const_builtin)\n (final_builtin)\n \"abstract\"\n \"covariant\"\n \"external\"\n \"static\"\n \"final\"\n \"base\"\n \"sealed\"\n] @keyword.modifier\n\n; when used as an identifier:\n((identifier) @variable.builtin\n (#any-of? @variable.builtin\n \"abstract\" \"as\" \"covariant\" \"deferred\" \"dynamic\" \"export\" \"external\" \"factory\" \"Function\" \"get\"\n \"implements\" \"import\" \"interface\" \"library\" \"operator\" \"mixin\" \"part\" \"set\" \"static\" \"typedef\"))\n\n[\n \"if\"\n \"else\"\n \"switch\"\n \"default\"\n] @keyword.conditional\n\n(conditional_expression\n [\n \"?\"\n \":\"\n ] @keyword.conditional.ternary)\n\n[\n \"try\"\n \"throw\"\n \"catch\"\n \"finally\"\n (break_statement)\n] @keyword.exception\n\n[\n \"do\"\n \"while\"\n \"continue\"\n \"for\"\n] @keyword.repeat",
19
+ "injections": "; This file is auto-generated. Do not edit.\n((comment) @injection.content\n (#set! injection.language \"comment\"))",
20
+ "locals": "; This file is auto-generated. Do not edit.\n; Definitions\n(function_signature\n name: (identifier) @local.definition.function)\n\n(formal_parameter\n name: (identifier) @local.definition.parameter)\n\n(initialized_variable_definition\n name: (identifier) @local.definition.var)\n\n(initialized_identifier\n (identifier) @local.definition.var)\n\n(static_final_declaration\n (identifier) @local.definition.var)\n\n; References\n(identifier) @local.reference\n\n; Scopes\n(class_definition\n body: (_) @local.scope)\n\n[\n (block)\n (if_statement)\n (for_statement)\n (while_statement)\n (try_statement)\n (catch_clause)\n (finally_clause)\n] @local.scope",
21
+ "brackets": "; This file is auto-generated. Do not edit.\n(\"(\" @open\n \")\" @close)\n\n(\"[\" @open\n \"]\" @close)\n\n(\"{\" @open\n \"}\" @close)\n"
22
+ }
23
+ }
24
+ }
25
+
26
+ export const dart = {
27
+ id: "dart",
28
+ aliases: [],
29
+ packageName: "@lumis-sh/wasm-dart",
30
+ wasm,
31
+ languagePackage,
32
+ }
33
+
34
+ export default dart
package/lumis.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "packageName": "@lumis-sh/wasm-dart",
3
- "version": "0.26.3",
3
+ "version": "0.26.4",
4
4
  "definitionHash": "fb831d8b6931dcb442d0623ff8a7b63123d24a1de0eab3833a2c1cd713958d12",
5
5
  "parser": {
6
6
  "name": "tree-sitter-dart",
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@lumis-sh/wasm-dart",
3
- "version": "0.26.3",
3
+ "version": "0.26.4",
4
4
  "type": "module",
5
5
  "types": "./index.d.ts",
6
- "description": "Self-contained Lumis language package for dart",
6
+ "description": "Tree-sitter parser and queries for dart, compiled to WASM for Lumis",
7
7
  "author": "Leandro Pereira",
8
8
  "license": "MIT",
9
9
  "homepage": "https://lumis.sh",
@@ -21,9 +21,16 @@
21
21
  },
22
22
  "lumis": {
23
23
  "treeSitter": "0.26",
24
- "formatVersion": 3,
24
+ "formatVersion": 4,
25
25
  "definitionHash": "fb831d8b6931dcb442d0623ff8a7b63123d24a1de0eab3833a2c1cd713958d12"
26
26
  },
27
+ "peerDependencies": {
28
+ "@lumis-sh/lumis": ">=0.9.0"
29
+ },
30
+ "peerDependenciesMeta": {
31
+ "@lumis-sh/lumis": { "optional": true }
32
+ },
33
+ "dependencies": {},
27
34
  "keywords": ["lumis-sh", "wasm", "tree-sitter"],
28
35
  "files": ["*.wasm", "*.json", "*.js", "*.d.ts", "README.md", "LICENSE"]
29
36
  }
File without changes