Skip to content

Commit 613dda8

Browse files
committed
chore: update dependencies
1 parent 87a5216 commit 613dda8

File tree

8 files changed

+472
-608
lines changed

8 files changed

+472
-608
lines changed

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
"description": "Integrates phpfmt into VS Code",
66
"main": "./dist/extension",
77
"scripts": {
8-
"build": "nr clean && tsc && tsup && tsx scripts/copy.mts",
8+
"build": "nr clean && tsc && tsdown && tsx scripts/copy.mts",
99
"build:docs": "tsx scripts/docs.mts",
1010
"type:gen": "vscode-ext-gen --output src/meta.ts --scope phpfmt",
1111
"prebuild": "nr type:gen && nr build:docs",
12-
"watch": "tsup --watch",
12+
"watch": "tsdown --watch",
1313
"clean": "rimraf out",
1414
"postinstall": "node ./node_modules/phpfmt/v2/install",
1515
"pretest": "nr build",
@@ -684,7 +684,6 @@
684684
"@antfu/ni": "^23.2.0",
685685
"@kokororin/prettierrc": "^0.1.1",
686686
"@octokit/rest": "^21.1.0",
687-
"@types/adm-zip": "^0.5.7",
688687
"@types/debug": "^4.1.12",
689688
"@types/got": "^9.6.12",
690689
"@types/md5": "^2.3.5",
@@ -694,15 +693,14 @@
694693
"@types/vscode": "^1.96.0",
695694
"@vscode/test-electron": "^2.4.1",
696695
"@vscode/vsce": "^3.2.1",
697-
"adm-zip": "^0.5.16",
698696
"consola": "^3.4.0",
699697
"debug": "^4.3.4",
700698
"dirname-filename-esm": "^1.1.2",
701699
"eslint": "^9.20.0",
702700
"eslint-config-prettier": "^10.1.8",
703701
"eslint-plugin-prettier": "^5.5.3",
704702
"execa": "^9.5.2",
705-
"fast-glob": "^3.3.3",
703+
"fflate": "^0.8.2",
706704
"got": "^14.4.5",
707705
"is-in-ci": "^1.0.0",
708706
"json5": "^2.2.3",
@@ -715,7 +713,8 @@
715713
"rimraf": "^6.0.1",
716714
"semver": "^7.6.0",
717715
"simple-git": "^3.22.0",
718-
"tsup": "^8.3.0",
716+
"tinyglobby": "^0.2.14",
717+
"tsdown": "^0.13.1",
719718
"tsx": "^4.19.1",
720719
"type-fest": "^4.41.0",
721720
"typescript": "~5.5.0",

pnpm-lock.yaml

Lines changed: 441 additions & 582 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/copy.mts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import phpfmt from 'phpfmt';
66

77
const __dirname = dirname(import.meta);
88

9+
const pkgPath = path.join(__dirname, '..');
10+
const distPath = path.join(pkgPath, 'dist');
11+
const destPath = path.join(distPath, phpfmt.v2.pharName);
12+
913
try {
10-
const pkgPath = path.join(__dirname, '..');
11-
const distPath = path.join(pkgPath, 'dist');
12-
const destPath = path.join(distPath, phpfmt.v2.pharName);
13-
const pharContent = await fs.readFile(phpfmt.v2.pharPath, 'binary');
14-
await fs.writeFile(destPath, pharContent);
14+
await fs.mkdir(distPath, { recursive: true });
15+
await fs.copyFile(phpfmt.v2.pharPath, destPath);
1516
} catch (err) {
1617
console.error(err);
1718
process.exit(1);

scripts/release.mts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
/* eslint no-console: error */
12
import fs from 'node:fs/promises';
23
import os from 'node:os';
3-
/* eslint no-console: error */
44
import path from 'node:path';
55
import process from 'node:process';
66
import { Octokit } from '@octokit/rest';
7-
import AdmZip from 'adm-zip';
87
import { consola } from 'consola';
98
import debug from 'debug';
109
import { dirname } from 'dirname-filename-esm';
1110
import { $ } from 'execa';
11+
import * as fflate from 'fflate';
1212
import { got } from 'got';
1313
import isInCi from 'is-in-ci';
1414
import md5 from 'md5';
@@ -50,16 +50,22 @@ try {
5050
throw new Error('Download vsix failed');
5151
}
5252

53-
const zip = new AdmZip(currentVsix);
54-
const zipEntries = zip.getEntries();
55-
const entry = zipEntries.find(
56-
o => o.entryName === `extension/dist/${phpfmt.v2.pharName}`
57-
);
58-
if (entry == null) {
53+
const zipData = await new Promise<fflate.Unzipped>((resolve, reject) => {
54+
fflate.unzip(new Uint8Array(currentVsix), (err, data) => {
55+
if (err) {
56+
reject(err);
57+
} else {
58+
resolve(data);
59+
}
60+
});
61+
});
62+
63+
const entryPath = `extension/dist/${phpfmt.v2.pharName}`;
64+
if (!(entryPath in zipData)) {
5965
throw new Error('Not found phar in vsix');
6066
}
6167

62-
const currentPharData = String(entry.getData());
68+
const currentPharData = new TextDecoder().decode(zipData[entryPath]);
6369
const currentMd5 = md5(currentPharData);
6470
consola.info(`Current md5: ${currentMd5}`);
6571

src/meta.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Meta info
55
export const publisher = "kokororin"
66
export const name = "vscode-phpfmt"
7-
export const version = "1.2.51"
7+
export const version = "1.2.52"
88
export const displayName = "phpfmt - PHP formatter"
99
export const description = "Integrates phpfmt into VS Code"
1010
export const extensionId = `${publisher}.${name}`

test/suite/extension.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import assert from 'node:assert';
2-
import fg from 'fast-glob';
32
import readPkgUp from 'read-pkg-up';
3+
import { glob } from 'tinyglobby';
44
import * as vscode from 'vscode';
55

66
const { packageJson: pkg } = readPkgUp.sync({ cwd: __dirname }) ?? {};
@@ -22,7 +22,7 @@ suite('PHPFmt Test', () => {
2222
}
2323

2424
const workspaceFolder = vscode.workspace.workspaceFolders[0].uri.fsPath;
25-
const phpFiles = await fg(['**/*.php'], {
25+
const phpFiles = await glob(['**/*.php'], {
2626
cwd: workspaceFolder,
2727
absolute: true
2828
});

test/suite/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as path from 'node:path';
2-
import { sync as globSync } from 'fast-glob';
32
import Mocha from 'mocha';
3+
import { globSync } from 'tinyglobby';
44

55
export function run(
66
testsRoot: string,

tsup.config.ts renamed to tsdown.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { defineConfig } from 'tsup';
1+
import { defineConfig } from 'tsdown';
22

33
export default defineConfig({
44
entry: ['src/extension.ts'],
55
format: ['cjs'],
6-
shims: false,
76
dts: false,
87
noExternal: [/^((?!(vscode)).)*$/],
98
external: ['vscode']

0 commit comments

Comments
 (0)