diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index d025559..cbe17ea 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -1,80 +1,70 @@ name: Test and Build on: - push: # すべてのブランチのプッシュで実行 - pull_request: # すべてのブランチへのプルリクエストで実行 + pull_request jobs: test: runs-on: ubuntu-latest - + steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - cache: 'npm' - - - name: Install all dependencies - run: | - npm ci - cd server && npm ci && cd .. - - - name: Compile TypeScript - run: npm run compile - - - name: Lint code - run: npm run lint - - - name: Run tests - run: npm test || echo "Tests not configured yet" + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Install all dependencies + run: | + npm ci + cd server && npm ci && cd .. + + - name: Compile TypeScript + run: npm run compile + + - name: Lint code + run: npm run lint + + - name: Run tests + run: npm test || echo "Tests not configured yet" build: runs-on: ubuntu-latest needs: test - + steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - cache: 'npm' - - - name: Clean and install production dependencies - run: | - # Clean existing node_modules - rm -rf node_modules server/node_modules - # Install only production dependencies - npm ci --omit=dev - cd server && npm ci --omit=dev && cd .. - - - name: Install build tools (TypeScript and type definitions) - run: | - # Install TypeScript compiler and type definitions for build only - npm install --no-save typescript @types/node - cd server && npm install --no-save typescript @types/node && cd .. - - - name: Compile TypeScript - run: npm run compile - - - name: Install VSCE - run: npm install -g @vscode/vsce - - - name: Package VSIX - run: vsce package - - - name: Upload VSIX artifact - uses: actions/upload-artifact@v4 - with: - name: outlinetext-vsix-${{ github.sha }} - path: '*.vsix' - retention-days: 30 - - - name: Show package contents - run: vsce ls --tree + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Install dependencies + run: | + npm ci + cd server && npm ci && cd .. + + - name: Compile TypeScript + run: npm run compile + + - name: Install VSCE + run: npm install -g @vscode/vsce + + - name: Package VSIX + run: vsce package + + - name: Upload VSIX artifact + uses: actions/upload-artifact@v4 + with: + name: outlinetext-vsix-${{ github.sha }} + path: "*.vsix" + retention-days: 30 + + - name: Show package contents + run: vsce ls --tree diff --git a/.gitignore b/.gitignore index 0b60dfa..1d4aec8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ dist node_modules .vscode-test/ *.vsix + +CLAUDE.md diff --git a/package-lock.json b/package-lock.json index 79b361b..d088b1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "outlinetext", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "outlinetext", - "version": "0.1.0", + "version": "0.1.1", "dependencies": { "vscode-languageclient": "^9.0.1", "vscode-languageserver": "^9.0.1", diff --git a/package.json b/package.json index 1d461a3..2ba4498 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "outlinetext", "displayName": "OutlineText", "description": "OutlineText language support with LSP and WASM parser for Visual Studio Code.", - "version": "0.1.1", + "version": "0.2.0", "preview": true, "publisher": "ContentsViewer", "icon": "./images/outlinetext.png", diff --git a/server/package-lock.json b/server/package-lock.json index 16572df..0679c45 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -8,8 +8,8 @@ "name": "outlinetext-server", "version": "0.1.0", "dependencies": { - "@php-wasm/node": "^1.1.4", - "@php-wasm/universal": "^1.1.4", + "@php-wasm/node": "^3.0.35", + "@php-wasm/universal": "^3.0.35", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.11" }, @@ -19,99 +19,296 @@ } }, "node_modules/@php-wasm/logger": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@php-wasm/logger/-/logger-1.1.4.tgz", - "integrity": "sha512-lNmYiovqvtVpaS/7LFZ2K6T95uRIGf4N2clLdNjwy/coIWrrQmNGEQs2sxed7K6p3R7sm85V4mM/FDXjwQDGmQ==", + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/logger/-/logger-3.0.35.tgz", + "integrity": "sha512-IvA/OZsBYk/ghe3lQFuqIhXgwSuFY6NkxTD/Vhp+sy/zPBAbS35o+nmeYymRs9uppY9yk2TQstFJ7Mr3PHm69A==", "license": "GPL-2.0-or-later", "dependencies": { - "@php-wasm/node-polyfills": "1.1.4" + "@php-wasm/node-polyfills": "3.0.35" }, "engines": { "node": ">=20.18.3", "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" } }, "node_modules/@php-wasm/node": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@php-wasm/node/-/node-1.1.4.tgz", - "integrity": "sha512-PJTI96hKM9w41ha47jqIEmRCLRSEyYW3pF5KXlpmcORK0/UIMCnQL5EzMUSPNoakDjXcnFRaARndaxkwCpFeFA==", + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/node/-/node-3.0.35.tgz", + "integrity": "sha512-ShjfCLFLnrztv+YjathjNXnrYn41R81VxNFT7SJeRvxdsJjNqW1VgAbaa5dZZbVcOzi27Mguv2kLea8bEvMnBw==", "license": "GPL-2.0-or-later", "dependencies": { - "@php-wasm/logger": "1.1.4", - "@php-wasm/node-polyfills": "1.1.4", - "@php-wasm/universal": "1.1.4", - "@php-wasm/util": "1.1.4", - "@wp-playground/common": "1.1.4", - "@wp-playground/wordpress": "1.1.4", - "comlink": "^4.4.2", + "@php-wasm/logger": "3.0.35", + "@php-wasm/node-7-2": "3.0.35", + "@php-wasm/node-7-3": "3.0.35", + "@php-wasm/node-7-4": "3.0.35", + "@php-wasm/node-8-0": "3.0.35", + "@php-wasm/node-8-1": "3.0.35", + "@php-wasm/node-8-2": "3.0.35", + "@php-wasm/node-8-3": "3.0.35", + "@php-wasm/node-8-4": "3.0.35", + "@php-wasm/node-8-5": "3.0.35", + "@php-wasm/node-polyfills": "3.0.35", + "@php-wasm/universal": "3.0.35", + "@php-wasm/util": "3.0.35", + "@wp-playground/common": "3.0.35", "express": "4.21.2", - "fs-ext": "2.1.1", "ini": "4.1.2", "wasm-feature-detect": "1.8.0", - "ws": "8.18.1", + "ws": "8.18.3", "yargs": "17.7.2" }, "engines": { "node": ">=20.18.3", "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" + } + }, + "node_modules/@php-wasm/node-7-2": { + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/node-7-2/-/node-7-2-3.0.35.tgz", + "integrity": "sha512-WCkU10C6O6KRy+e5CiE11gSfIK5bXMmoR4uTpmEsFwvKptqgbxpwgR9Nq60bUPnua6U4/R+XiNLYLPuZO1nR9A==", + "license": "GPL-2.0-or-later", + "dependencies": { + "@php-wasm/universal": "3.0.35", + "ini": "4.1.2", + "wasm-feature-detect": "1.8.0", + "ws": "8.18.3" + }, + "engines": { + "node": ">=20.18.3", + "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" + } + }, + "node_modules/@php-wasm/node-7-3": { + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/node-7-3/-/node-7-3-3.0.35.tgz", + "integrity": "sha512-RwCydgevS/IZ8upEnRIHHNXvfGeNpzIjoIlzP0LXDNxFvK7QXCT5qMXaVXIAbLCf1a5mpizU6Ak1cdHFCj1kEw==", + "license": "GPL-2.0-or-later", + "dependencies": { + "@php-wasm/universal": "3.0.35", + "ini": "4.1.2", + "wasm-feature-detect": "1.8.0", + "ws": "8.18.3" + }, + "engines": { + "node": ">=20.18.3", + "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" + } + }, + "node_modules/@php-wasm/node-7-4": { + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/node-7-4/-/node-7-4-3.0.35.tgz", + "integrity": "sha512-Q3zY2ljiVqkRumO4sbh1ziP6p4kA7NU/E5GdL3GRoaYe2AoXeI9aQoeHebtZnlIGU6TRX3nl43/oJ+CM++fZAg==", + "license": "GPL-2.0-or-later", + "dependencies": { + "@php-wasm/universal": "3.0.35", + "ini": "4.1.2", + "wasm-feature-detect": "1.8.0", + "ws": "8.18.3" + }, + "engines": { + "node": ">=20.18.3", + "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" + } + }, + "node_modules/@php-wasm/node-8-0": { + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/node-8-0/-/node-8-0-3.0.35.tgz", + "integrity": "sha512-GVjjO1E5/s43jbtPWAh9nt2knz9NbtaHjiOy6KNLntJfApOdNAiXpmmeaNWuEyjt1uziuoOIjqT+m2S4lJ82Fg==", + "license": "GPL-2.0-or-later", + "dependencies": { + "@php-wasm/universal": "3.0.35", + "ini": "4.1.2", + "wasm-feature-detect": "1.8.0", + "ws": "8.18.3" + }, + "engines": { + "node": ">=20.18.3", + "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" + } + }, + "node_modules/@php-wasm/node-8-1": { + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/node-8-1/-/node-8-1-3.0.35.tgz", + "integrity": "sha512-CEaFCYD5Pbv/+797WaLcTmwfmw2u7Ahg7297xRy8Lmu2qwoo993w1HbMVUwmWSZrJwuaH2Z78b155pjJtWJRPA==", + "license": "GPL-2.0-or-later", + "dependencies": { + "@php-wasm/universal": "3.0.35", + "ini": "4.1.2", + "wasm-feature-detect": "1.8.0", + "ws": "8.18.3" + }, + "engines": { + "node": ">=20.18.3", + "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" + } + }, + "node_modules/@php-wasm/node-8-2": { + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/node-8-2/-/node-8-2-3.0.35.tgz", + "integrity": "sha512-IJhQod279wDu+7nB1cX5WIOhOIvEXdb72KRdKdzgF7LlUJ4lDrKCkmJPq0dFFDrDbF87u1fHM0wtTb6Jj5FPYA==", + "license": "GPL-2.0-or-later", + "dependencies": { + "@php-wasm/universal": "3.0.35", + "ini": "4.1.2", + "wasm-feature-detect": "1.8.0", + "ws": "8.18.3" + }, + "engines": { + "node": ">=20.18.3", + "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" + } + }, + "node_modules/@php-wasm/node-8-3": { + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/node-8-3/-/node-8-3-3.0.35.tgz", + "integrity": "sha512-E19neMeImUX088XJve2x6Fnz9C5MgqgVzZijTTSCjnYRHf4utd96aVGvPwUJqLNROzGdRy083WmihcA1pn0fsw==", + "license": "GPL-2.0-or-later", + "dependencies": { + "@php-wasm/universal": "3.0.35", + "ini": "4.1.2", + "wasm-feature-detect": "1.8.0", + "ws": "8.18.3" + }, + "engines": { + "node": ">=20.18.3", + "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" + } + }, + "node_modules/@php-wasm/node-8-4": { + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/node-8-4/-/node-8-4-3.0.35.tgz", + "integrity": "sha512-aSSceS102okym+6xJMBc1QjBjQM4BgujxJEEnrYbd/ASfqteZ5UbWSEAzp2OKgM/KC5NtAdVgrPYhRJwPzU9PA==", + "license": "GPL-2.0-or-later", + "dependencies": { + "@php-wasm/universal": "3.0.35", + "ini": "4.1.2", + "wasm-feature-detect": "1.8.0", + "ws": "8.18.3" + }, + "engines": { + "node": ">=20.18.3", + "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" + } + }, + "node_modules/@php-wasm/node-8-5": { + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/node-8-5/-/node-8-5-3.0.35.tgz", + "integrity": "sha512-OvtI0Z/INzJ6PykkXr57SGRuceotOaaqDp4j8OZr83ZkzLLEiMINRu0hz1NpkS5V4QRSGf8k/A0NyvsO44EoMQ==", + "license": "GPL-2.0-or-later", + "dependencies": { + "@php-wasm/universal": "3.0.35", + "ini": "4.1.2", + "wasm-feature-detect": "1.8.0", + "ws": "8.18.3" + }, + "engines": { + "node": ">=20.18.3", + "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" } }, "node_modules/@php-wasm/node-polyfills": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@php-wasm/node-polyfills/-/node-polyfills-1.1.4.tgz", - "integrity": "sha512-+i6HSczW7Xp4Kj9F4l22y3/O2iajdyLlxfWdnNXkT8nRrUq6p/2bgfJNjUl3yyQHjmsyNF0hYBTGsbzzTNmYjA==", - "license": "GPL-2.0-or-later" + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/node-polyfills/-/node-polyfills-3.0.35.tgz", + "integrity": "sha512-pLZdk6XbFXJKRyfLewwN1qEOs/5/Q8VN5TCiZCFuRXhSMRTu+P0ABVmJoPr/Gj70SlQWMeeICE9EE1WihZWhig==", + "license": "GPL-2.0-or-later", + "optionalDependencies": { + "fs-ext": "2.1.1" + } }, "node_modules/@php-wasm/progress": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@php-wasm/progress/-/progress-1.1.4.tgz", - "integrity": "sha512-5Rs3iFuHCy4LME79h8TJR3y3a1t+v7ULk5WaMc4SS9fpCy57tLwfdT+wB1ao+AVpMrVfb/HbNt9baV1G51SlFg==", + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/progress/-/progress-3.0.35.tgz", + "integrity": "sha512-L08mIckC4gMc1sUFDkuhr17bsvdF25YgRFt8ET2ySsscfApkL0qezDn1qqwYL0qquuBkxYTk/65cSwnUZF98xw==", "license": "GPL-2.0-or-later", "dependencies": { - "@php-wasm/logger": "1.1.4", - "@php-wasm/node-polyfills": "1.1.4" + "@php-wasm/logger": "3.0.35", + "@php-wasm/node-polyfills": "3.0.35" }, "engines": { "node": ">=20.18.3", "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" } }, "node_modules/@php-wasm/stream-compression": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@php-wasm/stream-compression/-/stream-compression-1.1.4.tgz", - "integrity": "sha512-/sdyI7Cytv8fPO6nR28jBJ8b09r6EM5n9TA9OfO49YodVLVQ9f+tjLz8YINjgo54OoYbUnF04taat2RcsUTatA==", + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/stream-compression/-/stream-compression-3.0.35.tgz", + "integrity": "sha512-K5EJ4EsIVucSx77vt+BBWY0LB28ZIckPNlLzzZroPKwnP0DU3IjAxESwTJnGcZ1X8CRQngpnpK1xQ5Oa6WI9SA==", "license": "GPL-2.0-or-later", "dependencies": { - "@php-wasm/node-polyfills": "1.1.4", - "@php-wasm/util": "1.1.4" + "@php-wasm/node-polyfills": "3.0.35", + "@php-wasm/util": "3.0.35" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" } }, "node_modules/@php-wasm/universal": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@php-wasm/universal/-/universal-1.1.4.tgz", - "integrity": "sha512-LISftIuu7kfCCCXocjQ6wSetN5LLRHYhknzfyjrJpCMssi/YGjnSG+b4mdT0NzV6/Cy9Nq2j6Ng+6dx7Gs3yLA==", + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/universal/-/universal-3.0.35.tgz", + "integrity": "sha512-hvKS5OK9+1+/VUhCBMd1OqJLM7X8FZ4TLgeyQXAUUXu6zsT4IjnIDbCPTefzBgvyJpJY2KxCmzq/fh0rHJIu4w==", "license": "GPL-2.0-or-later", "dependencies": { - "@php-wasm/logger": "1.1.4", - "@php-wasm/node-polyfills": "1.1.4", - "@php-wasm/progress": "1.1.4", - "@php-wasm/stream-compression": "1.1.4", - "@php-wasm/util": "1.1.4", - "comlink": "^4.4.2", + "@php-wasm/logger": "3.0.35", + "@php-wasm/node-polyfills": "3.0.35", + "@php-wasm/progress": "3.0.35", + "@php-wasm/stream-compression": "3.0.35", + "@php-wasm/util": "3.0.35", "ini": "4.1.2" }, "engines": { "node": ">=20.18.3", "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" } }, "node_modules/@php-wasm/util": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@php-wasm/util/-/util-1.1.4.tgz", - "integrity": "sha512-+VC1J9fbxgN6Ug9iaos5tmTOr+xBgr22/IeK4lLL7BcFHuElBhOsaXN2y6gQ8UU+qpvo2mHhSeRZJxmS8DPRGg==", + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@php-wasm/util/-/util-3.0.35.tgz", + "integrity": "sha512-aU7VCKs08/kJLO2HpU8tVvyF4N+aH0bW+pegZdGp3f4PJ3U/zbDnpbfdYgsNEUwBI5irwLKI31gYa1NVrBZIlg==", "engines": { "node": ">=20.18.3", "npm": ">=10.1.0" + }, + "optionalDependencies": { + "fs-ext": "2.1.1" } }, "node_modules/@types/node": { @@ -122,43 +319,21 @@ "license": "MIT" }, "node_modules/@wp-playground/common": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@wp-playground/common/-/common-1.1.4.tgz", - "integrity": "sha512-CWqpM78aDhtZ8obG+3ua7cvjt7X5JF6BekFR9FYh9wQYAyyHqXNLmN+tNQs6/FqMUSsOEmsPjFf3GCfiVyOoZA==", + "version": "3.0.35", + "resolved": "https://registry.npmjs.org/@wp-playground/common/-/common-3.0.35.tgz", + "integrity": "sha512-jpYcE2yt6r2CkeTljyMSxbcpjRFd22LTRcGlSLcLDwXSlmYkTesStGkvyuPxgbmKxURXy3IbUh2v7KaAAIDo+g==", "license": "GPL-2.0-or-later", "dependencies": { - "@php-wasm/universal": "1.1.4", - "@php-wasm/util": "1.1.4", - "comlink": "^4.4.2", + "@php-wasm/universal": "3.0.35", + "@php-wasm/util": "3.0.35", "ini": "4.1.2" }, "engines": { "node": ">=20.18.3", "npm": ">=10.1.0" - } - }, - "node_modules/@wp-playground/wordpress": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@wp-playground/wordpress/-/wordpress-1.1.4.tgz", - "integrity": "sha512-/dOhRR89E1NtTyD5xBXkZ9JmyWzKPVWUxkgdo1bF7SSFn2fW2sURnHPJP713Les45+GWtMhYevPpzdhst889Aw==", - "license": "GPL-2.0-or-later", - "dependencies": { - "@php-wasm/logger": "1.1.4", - "@php-wasm/node": "1.1.4", - "@php-wasm/universal": "1.1.4", - "@php-wasm/util": "1.1.4", - "@wp-playground/common": "1.1.4", - "comlink": "^4.4.2", - "express": "4.21.2", - "fs-ext": "2.1.1", - "ini": "4.1.2", - "wasm-feature-detect": "1.8.0", - "ws": "8.18.1", - "yargs": "17.7.2" }, - "engines": { - "node": ">=20.18.3", - "npm": ">=10.1.0" + "optionalDependencies": { + "fs-ext": "2.1.1" } }, "node_modules/accepts": { @@ -298,12 +473,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "license": "MIT" }, - "node_modules/comlink": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/comlink/-/comlink-4.4.2.tgz", - "integrity": "sha512-OxGdvBmJuNKSCMO4NTl1L47VRp6xn2wG4F/2hYzB6tiCb709otOxtEYCSvK80PtjODfXXZu8ds+Nw5kVCjqd2g==", - "license": "Apache-2.0" - }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -544,6 +713,7 @@ "resolved": "https://registry.npmjs.org/fs-ext/-/fs-ext-2.1.1.tgz", "integrity": "sha512-/TrISPOFhCkbgIRWK9lzscRzwPCu0PqtCcvMc9jsHKBgZGoqA0VzhspVht5Zu8lxaXjIYIBWILHpRotYkCCcQA==", "hasInstallScript": true, + "optional": true, "dependencies": { "nan": "^2.21.0" }, @@ -779,10 +949,11 @@ "license": "MIT" }, "node_modules/nan": { - "version": "2.22.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.22.2.tgz", - "integrity": "sha512-DANghxFkS1plDdRsX0X9pm0Z6SJNN6gBdtXfanwoZ8hooC5gosGFSBGRYHUVPz1asKA/kMRqDRdHrluZ61SpBQ==", - "license": "MIT" + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.24.0.tgz", + "integrity": "sha512-Vpf9qnVW1RaDkoNKFUvfxqAbtI8ncb8OJlqZ9wwpXzWPEsvsB1nvdUi6oYrHIkQ1Y/tMDnr1h4nczS0VB9Xykg==", + "license": "MIT", + "optional": true }, "node_modules/negotiator": { "version": "0.6.3", @@ -1216,9 +1387,9 @@ } }, "node_modules/ws": { - "version": "8.18.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.1.tgz", - "integrity": "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==", + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", "license": "MIT", "engines": { "node": ">=10.0.0" diff --git a/server/package.json b/server/package.json index 95fd0de..79f2961 100644 --- a/server/package.json +++ b/server/package.json @@ -3,8 +3,8 @@ "version": "0.1.0", "description": "OutlineText Language Server", "dependencies": { - "@php-wasm/node": "^1.1.4", - "@php-wasm/universal": "^1.1.4", + "@php-wasm/node": "^3.0.35", + "@php-wasm/universal": "^3.0.35", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.11" }, diff --git a/server/src/cache.ts b/server/src/cache.ts deleted file mode 100644 index 484cdf0..0000000 --- a/server/src/cache.ts +++ /dev/null @@ -1,101 +0,0 @@ -import crypto from 'crypto'; -import type { ParseResult } from './shared/types'; - -export class CacheManager { - private cache = new Map(); - private maxSize = 100; // Maximum number of cached items - private maxAge = 5 * 60 * 1000; // 5 minutes in milliseconds - - private generateKey(content: string): string { - return crypto.createHash('sha256').update(content).digest('hex').substring(0, 16); - } - - get(content: string): ParseResult | null { - const key = this.generateKey(content); - const entry = this.cache.get(key); - - if (!entry) { - return null; - } - - // Check if expired - if (Date.now() - entry.timestamp > this.maxAge) { - this.cache.delete(key); - return null; - } - - // Update access time - entry.lastAccess = Date.now(); - - return entry.result; - } - - set(content: string, result: ParseResult): void { - const key = this.generateKey(content); - - // Remove oldest entries if cache is full - if (this.cache.size >= this.maxSize) { - this.evictOldest(); - } - - const entry: CacheEntry = { - result, - timestamp: Date.now(), - lastAccess: Date.now(), - size: content.length - }; - - this.cache.set(key, entry); - } - - clear(): void { - this.cache.clear(); - } - - getStats(): CacheStats { - const entries = Array.from(this.cache.values()); - const totalSize = entries.reduce((sum, entry) => sum + entry.size, 0); - const avgAge = entries.length > 0 - ? entries.reduce((sum, entry) => sum + (Date.now() - entry.timestamp), 0) / entries.length - : 0; - - return { - size: this.cache.size, - maxSize: this.maxSize, - totalMemory: totalSize, - averageAge: avgAge, - hitRate: 0 // TODO: Implement hit rate tracking - }; - } - - private evictOldest(): void { - let oldestKey = ''; - let oldestTime = Date.now(); - - for (const [key, entry] of this.cache.entries()) { - if (entry.lastAccess < oldestTime) { - oldestTime = entry.lastAccess; - oldestKey = key; - } - } - - if (oldestKey) { - this.cache.delete(oldestKey); - } - } -} - -interface CacheEntry { - result: ParseResult; - timestamp: number; - lastAccess: number; - size: number; -} - -interface CacheStats { - size: number; - maxSize: number; - totalMemory: number; - averageAge: number; - hitRate: number; -} \ No newline at end of file diff --git a/server/src/parser.ts b/server/src/parser.ts index 296e1f0..33e0d2c 100644 --- a/server/src/parser.ts +++ b/server/src/parser.ts @@ -2,16 +2,8 @@ import path from 'path'; import fs from 'fs/promises'; import type { WasmParser, ParseOptions, ParseResult, ParseDiagnostic } from './shared/types'; -// PHP WASM interface -interface PhpWasm { - run(code: string): string; - setPhpCode(code: string): void; - call(functionName: string, ...args: any[]): any; -} - export class OutlineTextParser implements WasmParser { private isInitialized = false; - private wasmModule: any = null; private phpModule: any = null; async initialize(): Promise { @@ -20,7 +12,6 @@ export class OutlineTextParser implements WasmParser { } try { - // Try to load actual PHP WASM with correct API await this.initializePhpWasm(); console.log('PHP WASM parser initialized successfully.'); @@ -35,7 +26,7 @@ export class OutlineTextParser implements WasmParser { if (!this.isInitialized) { await this.initialize(); } - if (this.wasmModule === null) { + if (this.phpModule === null) { throw new Error('WASM parser is not initialized'); } @@ -69,45 +60,51 @@ export class OutlineTextParser implements WasmParser { // Cleanup WASM module this.phpModule = null; } - - if (this.wasmModule) { - this.wasmModule = null; - } - this.isInitialized = false; } private async initializePhpWasm(): Promise { try { - // Import correct modules according to documentation - const { PHP } = await import('@php-wasm/universal'); - const { loadNodeRuntime } = await import('@php-wasm/node'); - - // Load PHP runtime for Node.js and create PHP instance - const runtime = await loadNodeRuntime('8.3'); - this.phpModule = new PHP(runtime); - - { - // Load our OutlineText parser PHP code - const phpCodePath = path.join(__dirname, '../../wasm/php/OutlineText.php'); - const phpCode = await fs.readFile(phpCodePath, 'utf-8'); - await this.phpModule.writeFile('OutlineText.php', phpCode); - - // Execute the PHP code to register functions - const result = await this.phpModule.run({ - code: `` - }); - - if (result.errors) { - console.error('PHP errors:', result.errors); - throw new Error('PHP initialization failed: ' + result.errors); + // Import modules for @php-wasm v3.x + // eslint-disable-next-line @typescript-eslint/no-var-requires + const phpWasmUniversal = require('@php-wasm/universal'); + // eslint-disable-next-line @typescript-eslint/no-var-requires + const phpWasmNode = require('@php-wasm/node'); + + const PHP = phpWasmUniversal.PHP; + const loadNodeRuntime = phpWasmNode.loadNodeRuntime; + const FileLockManagerForNode = phpWasmNode.FileLockManagerForNode; + + // Create file lock manager for Node.js + const fileLockManager = new FileLockManagerForNode(); + + // Load PHP runtime for Node.js with file lock manager + const runtimeId = await loadNodeRuntime('8.3', { + emscriptenOptions: { + fileLockManager } - } + }); + + // Create PHP instance with the runtime ID + this.phpModule = new PHP(runtimeId); - this.wasmModule = this.phpModule; + // Load our OutlineText parser PHP code + const phpCodePath = path.join(__dirname, '../../wasm/php/OutlineText.php'); + const phpCode = await fs.readFile(phpCodePath, 'utf-8'); + this.phpModule.writeFile('/OutlineText.php', phpCode); + + // Execute the PHP code to register functions + const result = await this.phpModule.run({ + code: `` + }); + + if (result.errors) { + console.error('PHP errors:', result.errors); + throw new Error('PHP initialization failed: ' + result.errors); + } } catch (error) { console.error('PHP WASM initialization failed:', error); throw error; @@ -137,7 +134,7 @@ export class OutlineTextParser implements WasmParser { // Call PHP function through WASM using correct API const result = await this.phpModule.run({ code: ` = new TextDocuments(TextDocument); -// Parser and cache +// Parser const parser = new OutlineTextParser(); -const cache = new CacheManager(); // Settings let globalSettings: OutlineTextSettings = { - enableCache: true, autoRefresh: true, diagnosticsEnabled: true, maxDocumentSize: 1024 * 1024 // 1MB @@ -93,12 +90,8 @@ connection.onInitialized(async () => { }); connection.onDidChangeConfiguration(change => { - if (hasConfigurationCapability) { - cache.clear(); - } else { - globalSettings = ( - (change.settings.outlinetext || globalSettings) - ); + if (!hasConfigurationCapability) { + globalSettings = change.settings.outlinetext || globalSettings; } // Revalidate all open text documents @@ -117,30 +110,7 @@ connection.onRequest('outlinetext/parse', async (params: ParseRequest): Promise< try { const content = params.content; const options = params.options || {}; - - // Check cache - if (globalSettings.enableCache && options.enableCache !== false) { - const cached = cache.get(content); - if (cached) { - return { - ...cached, - metadata: { - parseTime: cached.metadata?.parseTime || 0, - ...cached.metadata, - cacheHit: true - } - }; - } - } - - // Parse with WASM const result = await parser.parse(content, options); - - // Store in cache - if (globalSettings.enableCache) { - cache.set(content, result); - } - return result; } catch (error) { connection.console.error('Parse error: ' + error); @@ -283,5 +253,4 @@ connection.listen(); // Cleanup on exit process.on('exit', () => { parser.dispose(); - cache.clear(); }); \ No newline at end of file diff --git a/server/src/shared/types.js b/server/src/shared/types.js deleted file mode 100644 index a653fdc..0000000 --- a/server/src/shared/types.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -// Shared types for OutlineText LSP -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OutlineTextLSP = void 0; -// LSP Custom Messages -var OutlineTextLSP; -(function (OutlineTextLSP) { - OutlineTextLSP.PARSE_REQUEST = 'outlinetext/parse'; - OutlineTextLSP.PREVIEW_REQUEST = 'outlinetext/preview'; - OutlineTextLSP.EXPORT_REQUEST = 'outlinetext/export'; -})(OutlineTextLSP || (exports.OutlineTextLSP = OutlineTextLSP = {})); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/server/src/shared/types.js.map b/server/src/shared/types.js.map deleted file mode 100644 index dc1e482..0000000 --- a/server/src/shared/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";AAAA,mCAAmC;;;AAiDnC,sBAAsB;AACtB,IAAiB,cAAc,CAI9B;AAJD,WAAiB,cAAc;IACd,4BAAa,GAAG,mBAAmB,CAAC;IACpC,8BAAe,GAAG,qBAAqB,CAAC;IACxC,6BAAc,GAAG,oBAAoB,CAAC;AACvD,CAAC,EAJgB,cAAc,8BAAd,cAAc,QAI9B"} \ No newline at end of file diff --git a/server/src/shared/types.ts b/server/src/shared/types.ts index 29bdc6a..4666695 100644 --- a/server/src/shared/types.ts +++ b/server/src/shared/types.ts @@ -7,7 +7,6 @@ export interface ParseRequest { } export interface ParseOptions { - enableCache?: boolean; outputFormat?: 'html' | 'ast'; maxSize?: number; sourceUri?: string; // URI of the source file for CURRENT_DIR replacement @@ -21,7 +20,6 @@ export interface ParseResult { export interface ParseMetadata { parseTime: number; - cacheHit?: boolean; references?: ReferenceInfo[]; headings?: HeadingInfo[]; } @@ -65,7 +63,6 @@ export interface WasmParser { // Settings Interface export interface OutlineTextSettings { - enableCache: boolean; autoRefresh: boolean; diagnosticsEnabled: boolean; maxDocumentSize: number; diff --git a/server/src/types/php-wasm.d.ts b/server/src/types/php-wasm.d.ts deleted file mode 100644 index 3fa3be4..0000000 --- a/server/src/types/php-wasm.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -declare module '@php-wasm/universal' { - export interface PHPRunOptions { - code: string; - } - - export interface PHPRunResult { - text: string; - errors: string; - exitCode: number; - } - - export class PHP { - constructor(runtime: any); - run(options: PHPRunOptions): Promise; - } -} - -declare module '@php-wasm/node' { - export function loadNodeRuntime(version: string): Promise; - export function createNodeFsMountHandler(): any; - export function useHostFilesystem(): any; - export function withNetworking(): any; -} \ No newline at end of file diff --git a/shared/types.js b/shared/types.js deleted file mode 100644 index a653fdc..0000000 --- a/shared/types.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -// Shared types for OutlineText LSP -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OutlineTextLSP = void 0; -// LSP Custom Messages -var OutlineTextLSP; -(function (OutlineTextLSP) { - OutlineTextLSP.PARSE_REQUEST = 'outlinetext/parse'; - OutlineTextLSP.PREVIEW_REQUEST = 'outlinetext/preview'; - OutlineTextLSP.EXPORT_REQUEST = 'outlinetext/export'; -})(OutlineTextLSP || (exports.OutlineTextLSP = OutlineTextLSP = {})); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/shared/types.js.map b/shared/types.js.map deleted file mode 100644 index dc1e482..0000000 --- a/shared/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";AAAA,mCAAmC;;;AAiDnC,sBAAsB;AACtB,IAAiB,cAAc,CAI9B;AAJD,WAAiB,cAAc;IACd,4BAAa,GAAG,mBAAmB,CAAC;IACpC,8BAAe,GAAG,qBAAqB,CAAC;IACxC,6BAAc,GAAG,oBAAoB,CAAC;AACvD,CAAC,EAJgB,cAAc,8BAAd,cAAc,QAI9B"} \ No newline at end of file diff --git a/shared/types.ts b/shared/types.ts deleted file mode 100644 index 9885291..0000000 --- a/shared/types.ts +++ /dev/null @@ -1,71 +0,0 @@ -// Shared types for OutlineText LSP - -export interface ParseRequest { - uri: string; - content: string; - options?: ParseOptions; -} - -export interface ParseOptions { - enableCache?: boolean; - outputFormat?: 'html' | 'ast'; - maxSize?: number; -} - -export interface ParseResult { - html: string; - metadata?: ParseMetadata; - diagnostics?: ParseDiagnostic[]; -} - -export interface ParseMetadata { - parseTime: number; - cacheHit?: boolean; - references?: ReferenceInfo[]; - headings?: HeadingInfo[]; -} - -export interface ReferenceInfo { - group: string; - key: string; - content: string; - citations: number; -} - -export interface HeadingInfo { - level: number; - text: string; - line: number; - id?: string; -} - -export interface ParseDiagnostic { - line: number; - column: number; - severity: 'error' | 'warning' | 'info'; - message: string; - code?: string; -} - -// LSP Custom Messages -export namespace OutlineTextLSP { - export const PARSE_REQUEST = 'outlinetext/parse'; - export const PREVIEW_REQUEST = 'outlinetext/preview'; - export const EXPORT_REQUEST = 'outlinetext/export'; -} - -// WASM Parser Interface -export interface WasmParser { - initialize(): Promise; - parse(content: string, options?: ParseOptions): Promise; - isReady(): boolean; - dispose(): void; -} - -// Settings Interface -export interface OutlineTextSettings { - enableCache: boolean; - autoRefresh: boolean; - diagnosticsEnabled: boolean; - maxDocumentSize: number; -} \ No newline at end of file