Skip to content

Commit

Permalink
chore(deps): upgrade to latest stable (#2962)
Browse files Browse the repository at this point in the history
  • Loading branch information
3 people authored May 30, 2024
1 parent 74e97c7 commit d108930
Show file tree
Hide file tree
Showing 19 changed files with 466 additions and 437 deletions.
755 changes: 380 additions & 375 deletions package-lock.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"prettify": "npx prettier . --write"
},
"devDependencies": {
"@file-services/memory": "^9.2.1",
"@file-services/node": "^9.2.1",
"@file-services/path": "^9.2.1",
"@file-services/types": "^9.2.1",
"@file-services/memory": "^9.3.0",
"@file-services/node": "^9.3.0",
"@file-services/path": "^9.3.0",
"@file-services/types": "^9.3.0",
"@rollup/plugin-html": "^1.0.3",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.16",
Expand All @@ -40,20 +40,20 @@
"@types/mocha": "^10.0.6",
"@types/node": "18",
"@types/postcss-safe-parser": "^5.0.4",
"@types/react": "^18.3.2",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/validate-npm-package-name": "^4.0.2",
"@types/yargs": "^17.0.32",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0",
"@typescript-eslint/rule-tester": "^7.9.0",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"@typescript-eslint/rule-tester": "^7.11.0",
"autoprefixer": "^10.4.19",
"c8": "^9.1.0",
"chai": "^4.3.10",
"chai-subset": "^1.6.0",
"create-listening-server": "^2.1.0",
"css-loader": "^7.1.1",
"esbuild": "^0.21.3",
"css-loader": "^7.1.2",
"esbuild": "^0.21.4",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"file-loader": "^6.2.0",
Expand All @@ -62,15 +62,15 @@
"mocha": "^10.4.0",
"node-eval": "^2.0.0",
"npm-run-all": "^4.1.5",
"playwright-chromium": "^1.44.0",
"playwright-core": "^1.44.0",
"playwright-chromium": "^1.44.1",
"playwright-core": "^1.44.1",
"postcss": "^8.4.38",
"promise-assist": "^2.0.1",
"raw-loader": "^4.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rimraf": "^5.0.7",
"rollup": "^4.17.2",
"rollup": "^4.18.0",
"source-map": "^0.7.4",
"source-map-loader": "^5.0.0",
"style-loader": "^4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"test": "mocha \"./dist/test/**/*.spec.js\" --timeout 25000"
},
"dependencies": {
"@file-services/node": "^9.2.1",
"@file-services/types": "^9.2.1",
"@file-services/node": "^9.3.0",
"@file-services/types": "^9.3.0",
"@stylable/build-tools": "^6.1.0",
"@stylable/code-formatter": "^6.1.0",
"@stylable/core": "^6.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core-test-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": "mocha \"./dist/test/**/*.spec.js\""
},
"dependencies": {
"@file-services/memory": "^9.2.1",
"@file-services/memory": "^9.3.0",
"@stylable/core": "^6.1.0",
"chai": "^4.3.10",
"flat": "^5.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": "mocha \"./dist/test/**/*.spec.js\""
},
"dependencies": {
"@file-services/resolve": "^9.2.1",
"@file-services/resolve": "^9.3.0",
"@tokey/css-selector-parser": "^0.6.2",
"@tokey/css-value-parser": "^0.1.4",
"@tokey/imports-parser": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-test-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"@stylable/runtime": "^6.1.0",
"node-eval": "^2.0.0",
"playwright-core": "^1.44.0",
"playwright-core": "^1.44.1",
"rimraf": "^5.0.7"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/esbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"esbuild": ">=0.17.18"
},
"dependencies": {
"@file-services/node": "^9.2.1",
"@file-services/node": "^9.3.0",
"@stylable/build-tools": "^6.1.0",
"@stylable/cli": "^6.1.0",
"@stylable/core": "^6.1.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin-stylable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"test": "mocha \"dist/test/**/*.spec.js\" --timeout 5000"
},
"dependencies": {
"@file-services/node": "^9.2.1",
"@file-services/node": "^9.3.0",
"@stylable/core": "^6.1.0",
"@typescript-eslint/scope-manager": "^7.9.0",
"@typescript-eslint/utils": "^7.9.0",
"@typescript-eslint/scope-manager": "^7.11.0",
"@typescript-eslint/utils": "^7.11.0",
"postcss-safe-parser": "^7.0.0"
},
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/experimental-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@stylable/core": "^6.1.0",
"@stylable/runtime": "^6.1.0",
"@stylable/webpack-plugin": "^6.1.0",
"css-loader": "^7.1.1",
"css-loader": "^7.1.2",
"decache": "^4.6.2",
"loader-utils": "^3.2.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": "mocha \"./dist/test/**/*.spec.js\""
},
"dependencies": {
"@file-services/node": "^9.2.1",
"@file-services/node": "^9.3.0",
"@stylable/core": "^6.1.0",
"@stylable/module-utils": "^6.1.0",
"@stylable/node": "^6.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/language-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"typescript": ">=3.8"
},
"dependencies": {
"@file-services/types": "^9.2.1",
"@file-services/typescript": "^9.2.1",
"@file-services/types": "^9.3.0",
"@file-services/typescript": "^9.3.0",
"@stylable/code-formatter": "^6.1.0",
"@stylable/core": "^6.1.0",
"@tokey/core": "^1.4.0",
Expand Down
13 changes: 10 additions & 3 deletions packages/language-service/src/lib/feature/color-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export function resolveDocumentColors(
const res = fixAndProcess(
src,
new ProviderPosition(0, 0),
fs.sep === '/' ? filePath.replace(/\\/g, '/') : filePath
fs.sep === '/' ? filePath.replace(/\\/g, '/') : filePath, // TODO: this is very suspicious
fs
);
const meta = res.processed.meta;

Expand Down Expand Up @@ -107,10 +108,16 @@ export function resolveDocumentColors(
export function getColorPresentation(
cssService: CssService,
document: TextDocument,
params: ColorPresentationParams
params: ColorPresentationParams,
fs: IFileSystem
): ColorPresentation[] {
const src = document.getText();
const res = fixAndProcess(src, new ProviderPosition(0, 0), params.textDocument.uri);
const res = fixAndProcess(
src,
new ProviderPosition(0, 0),
URI.parse(params.textDocument.uri).fsPath,
fs
);
const meta = res.processed.meta;

const wordStart = new ProviderPosition(
Expand Down
42 changes: 26 additions & 16 deletions packages/language-service/src/lib/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class Provider {
const src = context.document.getText();
const filePath = context.meta.source;
const pos = context.getPosition();
const res = fixAndProcess(src, pos, filePath);
const res = fixAndProcess(src, pos, filePath, fs);
const completions: Completion[] = [];

if (!res.processed.meta) {
Expand Down Expand Up @@ -153,7 +153,7 @@ export class Provider {
}

const callingMeta = this.stylable.analyze(filePath);
const { word, meta } = getDefSymbol(src, position, filePath, this.stylable);
const { word, meta } = getDefSymbol(src, position, filePath, this.stylable, fs);
if (!meta || !word) {
return [];
}
Expand Down Expand Up @@ -354,7 +354,7 @@ export class Provider {
}
const {
processed: { meta },
} = fixAndProcess(src, pos, filePath);
} = fixAndProcess(src, pos, filePath, fs);
if (!meta) {
return null;
}
Expand Down Expand Up @@ -1443,19 +1443,23 @@ export function getRefs(
): Location[] {
const callingMeta = stylable.analyze(filePath);

const symb = getDefSymbol(fs.readFileSync(filePath, 'utf8'), position, filePath, stylable);
const symb = getDefSymbol(
fs.readFileSync(filePath, 'utf8'),
position,
fs.realpathSync.native(filePath),
stylable,
fs
);

if (!symb.meta) {
return [];
}

const stylesheets: string[] = fs
.findFilesSync(stylable.projectRoot, {
filterFile: (fileDesc: IFileSystemDescriptor) => {
return fileDesc.name.endsWith('.st.css');
},
})
.map((stylesheetPath) => URI.file(stylesheetPath).fsPath);
const stylesheets: string[] = fs.findFilesSync(stylable.projectRoot, {
filterFile: (fileDesc: IFileSystemDescriptor) => {
return fileDesc.name.endsWith('.st.css');
},
});

return newFindRefs(symb.word, symb.meta, callingMeta, stylesheets, stylable, position);
}
Expand All @@ -1464,7 +1468,7 @@ export function createMeta(src: string, path: string) {
let meta: StylableMeta;
const fakes: postcss.Rule[] = [];
try {
const ast: postcss.Root = safeParse(src, { from: URI.file(path).fsPath });
const ast: postcss.Root = safeParse(src, { from: path });
if (ast.nodes) {
for (const node of ast.nodes) {
if (node.type === 'decl') {
Expand All @@ -1491,7 +1495,12 @@ export function createMeta(src: string, path: string) {
};
}

export function fixAndProcess(src: string, position: ProviderPosition, filePath: string) {
export function fixAndProcess(
src: string,
position: ProviderPosition,
filePath: string,
fs: IFileSystem
) {
let cursorLineIndex: number = position.character;
const lines = src.replace(/\r\n/g, '\n').split('\n');
let currentLine = lines[position.line];
Expand All @@ -1518,7 +1527,7 @@ export function fixAndProcess(src: string, position: ProviderPosition, filePath:
fixedSrc = lines.join('\n');
}

const processed = createMeta(fixedSrc, filePath);
const processed = createMeta(fixedSrc, fs.realpathSync.native(filePath));
return {
processed,
currentLine,
Expand Down Expand Up @@ -1688,9 +1697,10 @@ export function getDefSymbol(
src: string,
position: ProviderPosition,
filePath: string,
stylable: Stylable
stylable: Stylable,
fs: IFileSystem
) {
const res = fixAndProcess(src, position, filePath);
const res = fixAndProcess(src, position, filePath, fs);
let meta = res.processed.meta;
if (!meta) {
return { word: '', meta: null };
Expand Down
23 changes: 15 additions & 8 deletions packages/language-service/src/lib/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class StylableLanguageService {
const res = this.provider.getDefinitionLocation(
stylableFile.content,
doc.positionAt(offset),
filePath,
stylableFile.path,
this.fs
);

Expand Down Expand Up @@ -176,7 +176,12 @@ export class StylableLanguageService {
end: doc.positionAt(offset.end),
};

return getColorPresentation(this.cssService, doc, { color, range, textDocument: doc });
return getColorPresentation(
this.cssService,
doc,
{ color, range, textDocument: doc },
this.fs
);
}

return [];
Expand All @@ -194,7 +199,7 @@ export class StylableLanguageService {
stylableFile.content
);

getRenameRefs(filePath, doc.positionAt(offset), this.fs, this.stylable).forEach(
getRenameRefs(stylableFile.path, doc.positionAt(offset), this.fs, this.stylable).forEach(
(ref) => {
if (edit.changes![ref.uri]) {
edit.changes![ref.uri].push({ range: ref.range, newText: newName });
Expand Down Expand Up @@ -346,10 +351,11 @@ export class StylableLanguageService {
}

public getDefinitionLocation(src: string, position: ProviderPosition, filePath: string) {
const realFilePath = this.fs.realpathSync.native(filePath);
const defs = this.provider.getDefinitionLocation(
src,
position,
URI.file(filePath).fsPath,
realFilePath,
this.fs
);
return defs.map((loc) => Location.create(URI.file(loc.uri).fsPath, loc.range));
Expand All @@ -373,7 +379,7 @@ export class StylableLanguageService {
}

public getColorPresentation(document: TextDocument, params: ColorPresentationParams) {
return getColorPresentation(this.cssService, document, params);
return getColorPresentation(this.cssService, document, params, this.fs);
}

public diagnose(filePath: string): Diagnostic[] {
Expand All @@ -383,7 +389,7 @@ export class StylableLanguageService {
return createDiagnosis(
stylableFile.content,
stylableFile.stat.mtime.getTime(),
filePath,
stylableFile.path,
this.stylable,
this.cssService
);
Expand All @@ -404,9 +410,10 @@ export class StylableLanguageService {
const stat = this.fs.statSync(filePath);

if (stat.isFile()) {
const content = this.fs.readFileSync(filePath, 'utf8');
const realFilePath = this.fs.realpathSync.native(filePath);
const content = this.fs.readFileSync(realFilePath, 'utf8');
return {
path: filePath,
path: realFilePath,
content,
stat,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/test/test-kit/asserters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function getDefFromLoc({ filePath, pos }: { filePath: string; pos: Provid

export function getReferences(fileName: string, pos: ProviderPosition): Location[] {
const fullPath = path.join(CASES_PATH, fileName);
return stylableLSP.getRefs(URI.file(fullPath).fsPath, pos);
return stylableLSP.getRefs(fullPath, pos);
}

export function getSignatureHelp(fileName: string, prefix: string): SignatureHelp | null {
Expand Down
10 changes: 5 additions & 5 deletions packages/language-service/test/test-kit/stylable-fixtures-lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { Stylable } from '@stylable/core';
import { safeParse } from '@stylable/core/dist/index-internal';
import { StylableLanguageService } from '@stylable/language-service';

export const CASES_PATH = path.join(
path.dirname(require.resolve('@stylable/language-service/package.json')),
'test',
'fixtures',
'server-cases'
export const CASES_PATH = fs.realpathSync.native(
path.join(
path.dirname(require.resolve('@stylable/language-service/package.json')),
'test/fixtures/server-cases'
)
);

function requireModule(request: string) {
Expand Down
2 changes: 1 addition & 1 deletion packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": "mocha \"./dist/test/**/*.spec.js\" --timeout 10000"
},
"dependencies": {
"@file-services/node": "^9.2.1",
"@file-services/node": "^9.3.0",
"@stylable/build-tools": "^6.1.0",
"@stylable/core": "^6.1.0",
"@stylable/module-utils": "^6.1.0",
Expand Down
Loading

0 comments on commit d108930

Please sign in to comment.