@zenithbuild/language 0.5.0-beta.2.1
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/.github/workflows/release.yml +261 -0
- package/.releaserc.json +73 -0
- package/.vscodeignore +9 -0
- package/CHANGELOG.md +80 -0
- package/LICENSE +21 -0
- package/README.md +57 -0
- package/RELEASE_NOTES.md +30 -0
- package/assets/logo.png +0 -0
- package/bun.lock +91 -0
- package/icons/zen.icns +0 -0
- package/icons/zenith-icon-theme.json +14 -0
- package/language-configuration.json +121 -0
- package/package.json +161 -0
- package/scripts/build.js +141 -0
- package/scripts/release.ts +571 -0
- package/src/extension.ts +147 -0
- package/syntaxes/zenith.tmLanguage.json +672 -0
- package/test/fixtures/grammar-test.zen +36 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"comments": {
|
|
3
|
+
"lineComment": "//",
|
|
4
|
+
"blockComment": [
|
|
5
|
+
"/*",
|
|
6
|
+
"*/"
|
|
7
|
+
]
|
|
8
|
+
},
|
|
9
|
+
"brackets": [
|
|
10
|
+
[
|
|
11
|
+
"{",
|
|
12
|
+
"}"
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"[",
|
|
16
|
+
"]"
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"(",
|
|
20
|
+
")"
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
"<",
|
|
24
|
+
">"
|
|
25
|
+
]
|
|
26
|
+
],
|
|
27
|
+
"autoClosingPairs": [
|
|
28
|
+
{
|
|
29
|
+
"open": "{",
|
|
30
|
+
"close": "}"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"open": "[",
|
|
34
|
+
"close": "]"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"open": "(",
|
|
38
|
+
"close": ")"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"open": "<",
|
|
42
|
+
"close": ">",
|
|
43
|
+
"notIn": [
|
|
44
|
+
"string",
|
|
45
|
+
"comment"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"open": "\"",
|
|
50
|
+
"close": "\"",
|
|
51
|
+
"notIn": [
|
|
52
|
+
"string"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"open": "'",
|
|
57
|
+
"close": "'",
|
|
58
|
+
"notIn": [
|
|
59
|
+
"string",
|
|
60
|
+
"comment"
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"open": "`",
|
|
65
|
+
"close": "`",
|
|
66
|
+
"notIn": [
|
|
67
|
+
"string",
|
|
68
|
+
"comment"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"open": "<!--",
|
|
73
|
+
"close": "-->",
|
|
74
|
+
"notIn": [
|
|
75
|
+
"comment",
|
|
76
|
+
"string"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"surroundingPairs": [
|
|
81
|
+
{
|
|
82
|
+
"open": "{",
|
|
83
|
+
"close": "}"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"open": "[",
|
|
87
|
+
"close": "]"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"open": "(",
|
|
91
|
+
"close": ")"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"open": "<",
|
|
95
|
+
"close": ">"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"open": "\"",
|
|
99
|
+
"close": "\""
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"open": "'",
|
|
103
|
+
"close": "'"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"open": "`",
|
|
107
|
+
"close": "`"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"folding": {
|
|
111
|
+
"markers": {
|
|
112
|
+
"start": "^\\s*<!--\\s*#region\\b.*-->",
|
|
113
|
+
"end": "^\\s*<!--\\s*#endregion\\b.*-->"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"indentationRules": {
|
|
117
|
+
"increaseIndentPattern": "<(?!\\?|(?:area|base|br|col|frame|hr|html|img|input|keygen|link|menuitem|meta|param|source|track|wbr|script|style)\\b|[^>]*/>)([-_\\.A-Za-z0-9]+)(?=\\s|>)\\b[^>]*>(?!.*</\\1>)|<!--(?!.*-->)|\\{[^}\"']*$",
|
|
118
|
+
"decreaseIndentPattern": "^\\s*(</[-_\\.A-Za-z0-9]+\\b[^>]*>|-?-->|\\})"
|
|
119
|
+
},
|
|
120
|
+
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)"
|
|
121
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zenithbuild/language",
|
|
3
|
+
"displayName": "Zenith Language Support",
|
|
4
|
+
"description": "Syntax highlighting, IntelliSense, and editor support for Zenith Framework (.zen files)",
|
|
5
|
+
"version": "0.5.0-beta.2.1",
|
|
6
|
+
"publisher": "ZenithBuild",
|
|
7
|
+
"engines": {
|
|
8
|
+
"vscode": "^1.80.0"
|
|
9
|
+
},
|
|
10
|
+
"main": "./out/extension.js",
|
|
11
|
+
"activationEvents": [
|
|
12
|
+
"onLanguage:zenith",
|
|
13
|
+
"onCommand:zenith.runContractPack",
|
|
14
|
+
"onCommand:zenith.runLegacyTests",
|
|
15
|
+
"onCommand:zenith.build",
|
|
16
|
+
"onCommand:zenith.restartServer"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build:server": "cd ../zenith-language-server && bun run build",
|
|
20
|
+
"compile": "bun x esbuild src/extension.ts --bundle --outfile=out/extension.js --external:vscode --external:vscode-languageclient/node --format=cjs --platform=node && cp ../zenith-language-server/dist/server.js out/server.js",
|
|
21
|
+
"watch": "bun run compile -- --watch",
|
|
22
|
+
"build:markplace": "bun run build:marketplace",
|
|
23
|
+
"build:marketplace": "bun run build:server && bun run compile && node scripts/build.js marketplace",
|
|
24
|
+
"build:openvsx": "bun run build:server && bun run compile && node scripts/build.js openvsx",
|
|
25
|
+
"build:all": "bun run build:server && bun run compile && node scripts/build.js all",
|
|
26
|
+
"release": "bun run scripts/release.ts",
|
|
27
|
+
"release:dry": "bun run scripts/release.ts --dry-run",
|
|
28
|
+
"release:patch": "bun run scripts/release.ts --bump=patch",
|
|
29
|
+
"release:minor": "bun run scripts/release.ts --bump=minor",
|
|
30
|
+
"release:major": "bun run scripts/release.ts --bump=major",
|
|
31
|
+
"build": "tsc"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^20.0.0",
|
|
35
|
+
"@types/vscode": "^1.80.0",
|
|
36
|
+
"esbuild": "^0.19.0",
|
|
37
|
+
"typescript": "^5.0.0"
|
|
38
|
+
},
|
|
39
|
+
"categories": [
|
|
40
|
+
"Programming Languages"
|
|
41
|
+
],
|
|
42
|
+
"icon": "assets/logo.png",
|
|
43
|
+
"keywords": [
|
|
44
|
+
"zenith",
|
|
45
|
+
"zen",
|
|
46
|
+
"syntax",
|
|
47
|
+
"highlighting",
|
|
48
|
+
"intellisense",
|
|
49
|
+
"framework"
|
|
50
|
+
],
|
|
51
|
+
"contributes": {
|
|
52
|
+
"languages": [
|
|
53
|
+
{
|
|
54
|
+
"id": "zenith",
|
|
55
|
+
"aliases": [
|
|
56
|
+
"Zenith",
|
|
57
|
+
"zenith"
|
|
58
|
+
],
|
|
59
|
+
"extensions": [
|
|
60
|
+
".zen",
|
|
61
|
+
".zen.html",
|
|
62
|
+
".zenx"
|
|
63
|
+
],
|
|
64
|
+
"configuration": "./language-configuration.json"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"grammars": [
|
|
68
|
+
{
|
|
69
|
+
"language": "zenith",
|
|
70
|
+
"scopeName": "text.html.zenith",
|
|
71
|
+
"path": "./syntaxes/zenith.tmLanguage.json",
|
|
72
|
+
"embeddedLanguages": {
|
|
73
|
+
"source.js": "javascript",
|
|
74
|
+
"source.ts": "typescript",
|
|
75
|
+
"source.css": "css",
|
|
76
|
+
"text.html.basic": "html",
|
|
77
|
+
"meta.embedded.block.javascript": "javascript",
|
|
78
|
+
"meta.embedded.block.typescript": "typescript",
|
|
79
|
+
"meta.embedded.block.css": "css"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"configurationDefaults": {
|
|
84
|
+
"[zenith]": {
|
|
85
|
+
"editor.formatOnSave": true,
|
|
86
|
+
"editor.wordBasedSuggestions": "off",
|
|
87
|
+
"editor.suggest.insertMode": "replace",
|
|
88
|
+
"editor.semanticHighlighting.enabled": true,
|
|
89
|
+
"editor.quickSuggestions": {
|
|
90
|
+
"other": true,
|
|
91
|
+
"comments": false,
|
|
92
|
+
"strings": true
|
|
93
|
+
},
|
|
94
|
+
"editor.autoClosingBrackets": "always"
|
|
95
|
+
},
|
|
96
|
+
"emmet.includeLanguages": {
|
|
97
|
+
"zenith": "html"
|
|
98
|
+
},
|
|
99
|
+
"emmet.syntaxProfiles": {
|
|
100
|
+
"zenith": "html"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"commands": [
|
|
104
|
+
{
|
|
105
|
+
"command": "zenith.runContractPack",
|
|
106
|
+
"title": "Zenith: Run Contract Pack",
|
|
107
|
+
"category": "Zenith"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"command": "zenith.runLegacyTests",
|
|
111
|
+
"title": "Zenith: Run Legacy Tests",
|
|
112
|
+
"category": "Zenith"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"command": "zenith.build",
|
|
116
|
+
"title": "Zenith: Build",
|
|
117
|
+
"category": "Zenith"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"command": "zenith.restartServer",
|
|
121
|
+
"title": "Zenith: Restart Server",
|
|
122
|
+
"category": "Zenith"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"configuration": {
|
|
126
|
+
"type": "object",
|
|
127
|
+
"title": "Zenith",
|
|
128
|
+
"properties": {
|
|
129
|
+
"zenith.componentScripts": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"enum": [
|
|
132
|
+
"forbid",
|
|
133
|
+
"allow"
|
|
134
|
+
],
|
|
135
|
+
"default": "forbid",
|
|
136
|
+
"description": "Component script contract mode. 'forbid' enforces structural-only components; 'allow' disables this diagnostic."
|
|
137
|
+
},
|
|
138
|
+
"zenith.languageServer.path": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"default": "",
|
|
141
|
+
"description": "Optional absolute or workspace-relative path to a custom Zenith language server entry file."
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"repository": {
|
|
147
|
+
"type": "git",
|
|
148
|
+
"url": "https://github.com/zenithbuild/zenith"
|
|
149
|
+
},
|
|
150
|
+
"homepage": "https://github.com/zenithbuild/zenith#readme",
|
|
151
|
+
"bugs": {
|
|
152
|
+
"url": "https://github.com/zenithbuild/zenith/issues"
|
|
153
|
+
},
|
|
154
|
+
"publishConfig": {
|
|
155
|
+
"access": "public"
|
|
156
|
+
},
|
|
157
|
+
"license": "MIT",
|
|
158
|
+
"dependencies": {
|
|
159
|
+
"vscode-languageclient": "^9.0.1"
|
|
160
|
+
}
|
|
161
|
+
}
|
package/scripts/build.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Build script for Zenith VSCode Extension
|
|
5
|
+
* Supports dual publishing to VSCode Marketplace and Open VSX
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* node scripts/build.js marketplace - Build for VSCode Marketplace (ZenithBuild)
|
|
9
|
+
* node scripts/build.js openvsx - Build for Open VSX (zenithbuild)
|
|
10
|
+
* node scripts/build.js all - Build both
|
|
11
|
+
* node scripts/build.js - Defaults to marketplace
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const fs = require('fs');
|
|
15
|
+
const path = require('path');
|
|
16
|
+
const { execSync } = require('child_process');
|
|
17
|
+
|
|
18
|
+
const TARGETS = {
|
|
19
|
+
marketplace: {
|
|
20
|
+
publisher: 'ZenithBuild',
|
|
21
|
+
outputSuffix: 'vscode-marketplace'
|
|
22
|
+
},
|
|
23
|
+
openvsx: {
|
|
24
|
+
publisher: 'zenithbuild',
|
|
25
|
+
outputSuffix: 'openvsx'
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const packageJsonPath = path.join(__dirname, '..', 'package.json');
|
|
30
|
+
const rootDir = path.join(__dirname, '..');
|
|
31
|
+
const EXTENSION_ID = 'zenith-language';
|
|
32
|
+
const REQUIRED_PACKAGING_DEPS = ['vscode-languageclient'];
|
|
33
|
+
|
|
34
|
+
function readPackageJsonRaw() {
|
|
35
|
+
return fs.readFileSync(packageJsonPath, 'utf8');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function isDependencyInstalled(depName) {
|
|
39
|
+
return fs.existsSync(path.join(rootDir, 'node_modules', depName, 'package.json'));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function ensurePackagingDependencies() {
|
|
43
|
+
const missing = REQUIRED_PACKAGING_DEPS.filter((dep) => !isDependencyInstalled(dep));
|
|
44
|
+
if (missing.length === 0) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log(`š„ Installing missing packaging dependencies: ${missing.join(', ')}`);
|
|
49
|
+
execSync('bun install', {
|
|
50
|
+
cwd: rootDir,
|
|
51
|
+
stdio: 'inherit'
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function build(target) {
|
|
56
|
+
const config = TARGETS[target];
|
|
57
|
+
if (!config) {
|
|
58
|
+
console.error(`Unknown target: ${target}`);
|
|
59
|
+
console.error('Valid targets: marketplace, openvsx, all');
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
console.log(`\nš§ Building for ${target}`);
|
|
64
|
+
console.log(` Publisher: ${config.publisher}\n`);
|
|
65
|
+
|
|
66
|
+
// Read package.json
|
|
67
|
+
const originalPackageJsonRaw = readPackageJsonRaw();
|
|
68
|
+
const packageJson = JSON.parse(originalPackageJsonRaw);
|
|
69
|
+
const originalName = packageJson.name;
|
|
70
|
+
|
|
71
|
+
// Output filename
|
|
72
|
+
const outputName = `${EXTENSION_ID}-${config.outputSuffix}.vsix`;
|
|
73
|
+
const outputPath = path.join(rootDir, outputName);
|
|
74
|
+
|
|
75
|
+
// Update publisher
|
|
76
|
+
packageJson.publisher = config.publisher;
|
|
77
|
+
packageJson.name = EXTENSION_ID;
|
|
78
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 4) + '\n');
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
// Run vsce package
|
|
82
|
+
console.log('š¦ Packaging extension...\n');
|
|
83
|
+
ensurePackagingDependencies();
|
|
84
|
+
if (fs.existsSync(outputPath)) {
|
|
85
|
+
fs.unlinkSync(outputPath);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
execSync(`npx vsce package --out "${outputName}"`, {
|
|
89
|
+
cwd: rootDir,
|
|
90
|
+
stdio: 'inherit'
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
if (!fs.existsSync(outputPath)) {
|
|
94
|
+
throw new Error(`Expected build artifact was not created: ${outputName}`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
console.log(`\nā
Built: ${outputName}`);
|
|
98
|
+
console.log(` Publisher: ${config.publisher}`);
|
|
99
|
+
console.log(` Version: ${packageJson.version}`);
|
|
100
|
+
console.log(` Extension ID: ${EXTENSION_ID}`);
|
|
101
|
+
console.log(` Original package name: ${originalName}`);
|
|
102
|
+
|
|
103
|
+
if (target === 'marketplace') {
|
|
104
|
+
console.log('\nš¤ To publish to VSCode Marketplace:');
|
|
105
|
+
console.log(` npx vsce publish --packagePath "${outputName}"`);
|
|
106
|
+
} else {
|
|
107
|
+
console.log('\nš¤ To publish to Open VSX:');
|
|
108
|
+
console.log(` npx ovsx publish ${outputName} -p <TOKEN>`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return outputName;
|
|
112
|
+
|
|
113
|
+
} finally {
|
|
114
|
+
// Restore package.json exactly as it was before this build
|
|
115
|
+
fs.writeFileSync(packageJsonPath, originalPackageJsonRaw);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function buildAll() {
|
|
120
|
+
console.log('š Building for all targets...\n');
|
|
121
|
+
const outputs = [];
|
|
122
|
+
|
|
123
|
+
for (const target of Object.keys(TARGETS)) {
|
|
124
|
+
outputs.push(build(target));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
console.log('\n' + '='.repeat(50));
|
|
128
|
+
console.log('š¦ All builds complete!\n');
|
|
129
|
+
console.log('Generated files:');
|
|
130
|
+
outputs.forEach(output => console.log(` ⢠${output}`));
|
|
131
|
+
console.log('');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Get target from command line
|
|
135
|
+
const target = process.argv[2] || 'marketplace';
|
|
136
|
+
|
|
137
|
+
if (target === 'all') {
|
|
138
|
+
buildAll();
|
|
139
|
+
} else {
|
|
140
|
+
build(target);
|
|
141
|
+
}
|