Skip to content

Commit

Permalink
fix: Avoid downstream need node polyfill for browser
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Oct 30, 2023
1 parent b9c59e8 commit 8337a38
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 205 deletions.
3 changes: 0 additions & 3 deletions .npmrc

This file was deleted.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
"devDependencies": {
"@lerna-lite/cli": "latest",
"@lerna-lite/publish": "latest",
"@types/node": "latest",
"@volar/language-service": "latest",
"typescript": "latest",
"vscode-languageserver-protocol": "^3.17.5"
}
Expand Down
1 change: 1 addition & 0 deletions packages/css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"vscode-uri": "^3.0.8"
},
"devDependencies": {
"@types/node": "latest",
"vscode-languageserver-textdocument": "^1.0.11"
},
"peerDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/css/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { CodeAction, Diagnostic, LocationLink, Service } from '@volar/language-service';
import { posix as path } from 'path';
import * as css from 'vscode-css-languageservice';
import type { TextDocument } from 'vscode-languageserver-textdocument';
import { URI, Utils } from 'vscode-uri';
Expand Down Expand Up @@ -227,6 +226,8 @@ export function create(): Service<Provide> {

for (const customDataPath of customData) {
try {
const pathModuleName = 'path'; // avoid bundle
const { posix: path } = require(pathModuleName) as typeof import('path');
const jsonPath = path.resolve(customDataPath);
newData.push(css.newCSSDataProvider(require(jsonPath)));
}
Expand Down
1 change: 1 addition & 0 deletions packages/html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"vscode-uri": "^3.0.8"
},
"devDependencies": {
"@types/node": "latest",
"vscode-languageserver-textdocument": "^1.0.11"
},
"peerDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/html/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Service } from '@volar/language-service';
import * as html from 'vscode-html-languageservice';
import type { TextDocument } from 'vscode-languageserver-textdocument';
import * as path from 'path';
import { URI, Utils } from 'vscode-uri';

const parserLs = html.getLanguageService();
Expand Down Expand Up @@ -315,6 +314,8 @@ export function create({

for (const customDataPath of customData) {
try {
const pathModuleName = 'path'; // avoid bundle
const { posix: path } = require(pathModuleName) as typeof import('path');
const jsonPath = path.resolve(customDataPath);
newData.push(html.newHTMLDataProvider(customDataPath, require(jsonPath)));
}
Expand Down
1 change: 1 addition & 0 deletions packages/prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"url": "https://www.polv.cc"
},
"devDependencies": {
"@types/node": "latest",
"prettier": "^3.0.3"
},
"peerDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions packages/pug-beautify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@
"@volar/language-service": {
"optional": true
}
},
"devDependencies": {
"@types/node": "latest"
}
}
3 changes: 3 additions & 0 deletions packages/pug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"vscode-html-languageservice": "^5.1.0",
"vscode-languageserver-textdocument": "^1.0.11"
},
"devDependencies": {
"@types/node": "latest"
},
"browser": {
"./out/index.js": "./out/empty.js"
}
Expand Down
2 changes: 2 additions & 0 deletions packages/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
"url": "https://github.com/johnsoncodehk"
},
"devDependencies": {
"@types/path-browserify": "latest",
"@types/semver": "^7.5.4",
"@volar/typescript": "latest"
},
"dependencies": {
"path-browserify": "^1.0.1",
"semver": "^7.5.4",
"typescript-auto-import-cache": "^0.3.0",
"vscode-languageserver-textdocument": "^1.0.11",
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/src/configs/getUserPreferences.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type * as ts from 'typescript/lib/tsserverlibrary';
import { getConfigTitle } from '../shared';
import { posix as path } from 'path';
import * as path from 'path-browserify';
import { URI } from 'vscode-uri';
import { SharedContext } from '../types';
import type { TextDocument } from 'vscode-languageserver-textdocument';
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/src/features/callHierarchy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type * as ts from 'typescript/lib/tsserverlibrary';
import * as PConst from '../protocol.const';
import { parseKindModifier } from '../utils/modifiers';
import * as typeConverters from '../utils/typeConverters';
import { posix as path } from 'path';
import * as path from 'path-browserify';
import { SharedContext } from '../types';
import { safeCall } from '../shared';

Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/src/features/rename.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type * as ts from 'typescript/lib/tsserverlibrary';
import type * as vscode from '@volar/language-service';
import { posix as path } from 'path';
import * as path from 'path-browserify';
import { renameInfoOptions } from './prepareRename';
import { getFormatCodeSettings } from '../configs/getFormatCodeSettings';
import { getUserPreferences } from '../configs/getUserPreferences';
Expand Down
3 changes: 3 additions & 0 deletions packages/vetur/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@
"@volar/language-service": {
"optional": true
}
},
"devDependencies": {
"@types/node": "latest"
}
}
Loading

0 comments on commit 8337a38

Please sign in to comment.