@plurnk/plurnk-mimetypes-grammar-python 0.1.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/.grammar-pin +1 -0
- package/LICENSE +21 -0
- package/README.md +29 -0
- package/index.js +19 -0
- package/package.json +42 -0
- package/python.wasm +0 -0
package/.grammar-pin
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
26855eabccb19c6abf499fbc5b8dc7cc9ab8bc64
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PossumTech Laboratories, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @plurnk/plurnk-mimetypes-grammar-python
|
|
2
|
+
|
|
3
|
+
Pre-built `tree-sitter-python` WASM grammar for the [@plurnk/plurnk-mimetypes](https://github.com/plurnk/plurnk-mimetypes) framework.
|
|
4
|
+
|
|
5
|
+
## install
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm i @plurnk/plurnk-mimetypes-grammar-python
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
That's it — the framework automatically picks up the bundled WASM and enables Python (`text/x-python`) support.
|
|
12
|
+
|
|
13
|
+
## what's in here
|
|
14
|
+
|
|
15
|
+
- **`python.wasm`** — pre-built from the pinned upstream [tree-sitter-python](https://github.com/tree-sitter/tree-sitter-python) commit (recorded in `.grammar-pin`)
|
|
16
|
+
- `scripts/build-wasm.mjs` — reproducible build from the pinned source
|
|
17
|
+
- `scripts/verify-wasm.mjs` — CI check that the committed WASM matches a fresh rebuild byte-for-byte
|
|
18
|
+
|
|
19
|
+
There is no runtime code here. The framework's `TreeSitterLanguageHandler` resolves the WASM via `import.meta.resolve("@plurnk/plurnk-mimetypes-grammar-python/python.wasm")` and loads it through `web-tree-sitter`.
|
|
20
|
+
|
|
21
|
+
## why a separate package
|
|
22
|
+
|
|
23
|
+
Plurnk's "support every grammar" promise is paid for by per-grammar packages. The framework alone is small; you install only the grammars you actually use. Want Python? Install this. Want everything? `npm i @plurnk/plurnk-mimetypes-grammars-all`.
|
|
24
|
+
|
|
25
|
+
This model also kills the long-standing peer-dependency conflict between upstream `tree-sitter-{lang}` packages (which all declare different peer ranges of the native `tree-sitter` binding, which we don't need). Our grammar packages declare only `web-tree-sitter` as a peer — no node-gyp, no conflicts, ever.
|
|
26
|
+
|
|
27
|
+
## license
|
|
28
|
+
|
|
29
|
+
MIT. The bundled `python.wasm` is built from the upstream tree-sitter-python grammar, which is MIT-licensed; see the pinned commit for that project's attribution.
|
package/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Pre-built tree-sitter-python WASM grammar for @plurnk/plurnk-mimetypes.
|
|
2
|
+
//
|
|
3
|
+
// This package ships exactly one thing: python.wasm at the package root,
|
|
4
|
+
// reachable via the "./python.wasm" subpath export. The framework's
|
|
5
|
+
// TreeSitterLanguageHandler resolves it at runtime and hands it to
|
|
6
|
+
// web-tree-sitter's Language.load().
|
|
7
|
+
//
|
|
8
|
+
// There is no JS API to call. This file exists to give Node a default entry
|
|
9
|
+
// point for `import "@plurnk/plurnk-mimetypes-grammar-python"`, which the
|
|
10
|
+
// framework uses to detect presence via `import.meta.resolve()`. The export
|
|
11
|
+
// is the wasm-relative path so callers (almost always the framework) can
|
|
12
|
+
// route directly to the binary.
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
|
|
16
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
|
|
18
|
+
/** Absolute filesystem path to the bundled python.wasm. */
|
|
19
|
+
export const wasmPath = path.join(here, "python.wasm");
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@plurnk/plurnk-mimetypes-grammar-python",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Pre-built tree-sitter-python WASM grammar for @plurnk/plurnk-mimetypes. Install this package to enable Python (text/x-python) support in plurnk-service.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=25"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"default": "./index.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json",
|
|
18
|
+
"./python.wasm": "./python.wasm"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"python.wasm",
|
|
22
|
+
".grammar-pin",
|
|
23
|
+
"index.js",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build:wasm": "node scripts/build-wasm.mjs",
|
|
28
|
+
"verify:wasm": "node scripts/verify-wasm.mjs"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@plurnk/plurnk-mimetypes": ">=0.11.0",
|
|
32
|
+
"web-tree-sitter": "^0.25.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependenciesMeta": {
|
|
35
|
+
"@plurnk/plurnk-mimetypes": {
|
|
36
|
+
"optional": false
|
|
37
|
+
},
|
|
38
|
+
"web-tree-sitter": {
|
|
39
|
+
"optional": false
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
package/python.wasm
ADDED
|
Binary file
|