diff --git a/package.json b/package.json index 3f6434c728a..526ea5ee053 100644 --- a/package.json +++ b/package.json @@ -149,10 +149,7 @@ "ignoreBinaries": [ "playwright" ], - "ignoreDependencies": [ - "@shopify/theme-check-node", - "@shopify/theme-check-docs-updater" - ], + "ignoreDependencies": [], "ignoreWorkspaces": [ "packages/eslint-plugin-cli", "packages/e2e" @@ -201,6 +198,7 @@ "**/graphql/**/generated/*.ts" ], "ignoreDependencies": [ + "@graphql-typed-document-node/core", "@shopify/plugin-cloudflare" ], "vite": { @@ -217,7 +215,9 @@ ], "project": "**/*.ts!", "ignoreDependencies": [ - "@ast-grep/napi" + "@ast-grep/napi", + "@shopify/theme-check-docs-updater", + "@shopify/theme-check-node" ], "vite": { "config": [ @@ -290,6 +290,9 @@ "ignoreBinaries": [ "open" ], + "ignoreDependencies": [ + "@graphql-typed-document-node/core" + ], "vite": { "config": [ "vite.config.ts" @@ -308,10 +311,7 @@ "**/scripts/*.ts!", "**/src/testing/index.ts" ], - "project": "**/*.{ts,tsx}!", - "ignoreDependencies": [ - "react-dom" - ] + "project": "**/*.{ts,tsx}!" }, "packages/ui-extensions-test-utils": { "entry": [ diff --git a/packages/cli-kit/package.json b/packages/cli-kit/package.json index e6f7aba5d5d..9c8b4c4eb2a 100644 --- a/packages/cli-kit/package.json +++ b/packages/cli-kit/package.json @@ -120,7 +120,7 @@ "ansi-escapes": "6.2.1", "archiver": "5.3.2", "bottleneck": "2.19.5", - "brotli": "1.3.3", + "chalk": "5.4.1", "change-case": "4.1.2", "color-json": "3.0.5", @@ -168,7 +168,7 @@ "zod": "3.24.4" }, "devDependencies": { - "@types/brotli": "^1.3.4", + "@types/commondir": "^1.0.0", "@types/diff": "^5.2.3", "@types/fs-extra": "9.0.13", diff --git a/packages/cli-kit/src/public/node/archiver.integration.test.ts b/packages/cli-kit/src/public/node/archiver.integration.test.ts index 989609b9e16..892cb055e99 100644 --- a/packages/cli-kit/src/public/node/archiver.integration.test.ts +++ b/packages/cli-kit/src/public/node/archiver.integration.test.ts @@ -4,7 +4,7 @@ import {joinPath, dirname} from './path.js' import {exec} from './system.js' import {describe, expect, test} from 'vitest' import StreamZip from 'node-stream-zip' -import brotli from 'brotli' +import {brotliDecompressSync} from 'zlib' import fs from 'fs' @@ -92,8 +92,8 @@ describe('brotliCompress', () => { // Brotli files start with the bytes 0x1B... expect(compressedContent[0]).toBe(0x1b) - // Decompress using brotli library - const decompressed = brotli.decompress(compressedContent) + // Decompress using native zlib brotli + const decompressed = brotliDecompressSync(compressedContent) expect(decompressed).toBeTruthy() }) }) @@ -125,7 +125,7 @@ describe('brotliCompress', () => { // Save compressed content to a file const compressedContent = fs.readFileSync(brotliPath) - const decompressed = brotli.decompress(compressedContent) + const decompressed = brotliDecompressSync(compressedContent) const tmpTarPath = joinPath(tmpDir, 'output.tar') fs.writeFileSync(tmpTarPath, decompressed) diff --git a/packages/cli-kit/src/public/node/archiver.ts b/packages/cli-kit/src/public/node/archiver.ts index 1223c08af04..35d781a2f75 100644 --- a/packages/cli-kit/src/public/node/archiver.ts +++ b/packages/cli-kit/src/public/node/archiver.ts @@ -6,6 +6,7 @@ import {createWriteStream, readFileSync, writeFileSync} from 'fs' import {readFile} from 'fs/promises' import {tmpdir} from 'os' import {randomUUID} from 'crypto' +import {brotliCompressSync, constants as zlibConstants} from 'zlib' interface ZipOptions { /** @@ -183,16 +184,13 @@ export async function brotliCompress(options: BrotliOptions): Promise { }) const tarContent = readFileSync(tempTarPath) - const brotli = await import('brotli') - const compressed = brotli.default.compress(tarContent, { - quality: 7, - mode: 0, + const compressed = brotliCompressSync(tarContent, { + params: { + [zlibConstants.BROTLI_PARAM_QUALITY]: 7, + [zlibConstants.BROTLI_PARAM_MODE]: zlibConstants.BROTLI_MODE_GENERIC, + }, }) - if (!compressed) { - throw new Error('Brotli compression failed') - } - writeFileSync(options.outputPath, compressed) } finally { try { diff --git a/packages/cli/bin/bundle.js b/packages/cli/bin/bundle.js index 574bcff876d..82e230e197c 100644 --- a/packages/cli/bin/bundle.js +++ b/packages/cli/bin/bundle.js @@ -40,7 +40,7 @@ const hydrogenAssets = joinPath(hydrogenPath, 'dist/assets/hydrogen/**/*') esBuild({ bundle: true, - entryPoints: ['./src/**/*.ts'], + entryPoints: ['./src/index.ts'], outdir: './dist', platform: 'node', format: 'esm', @@ -58,9 +58,9 @@ esBuild({ splitting: true, // these tree shaking and minify options remove any in-source tests from the bundle treeShaking: true, - minifyWhitespace: false, + minifyWhitespace: true, minifySyntax: true, - minifyIdentifiers: false, + minifyIdentifiers: true, plugins: [ ShopifyVSCodePlugin, diff --git a/packages/cli/package.json b/packages/cli/package.json index 21235a532d4..a4f7e62656a 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -38,6 +38,7 @@ "/bin/run.cmd", "/bin/run.js", "/dist", + "!/dist/**/*.map", "/oclif.manifest.json" ], "scripts": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 95bb35d5434..e15351d35d2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -363,9 +363,6 @@ importers: bottleneck: specifier: 2.19.5 version: 2.19.5 - brotli: - specifier: 1.3.3 - version: 1.3.3 chalk: specifier: 5.4.1 version: 5.4.1 @@ -502,9 +499,6 @@ importers: specifier: 3.24.4 version: 3.24.4 devDependencies: - '@types/brotli': - specifier: ^1.3.4 - version: 1.3.4 '@types/commondir': specifier: ^1.0.0 version: 1.0.2 @@ -792,7 +786,7 @@ importers: devDependencies: '@testing-library/react': specifier: ^16.3.2 - version: 16.3.2(@testing-library/dom@10.4.1)(@types/react-dom@18.3.7(@types/react@18.3.12))(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 16.3.2(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@18.3.12))(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@types/react': specifier: 18.3.12 version: 18.3.12 @@ -4005,9 +3999,6 @@ packages: '@types/body-parser@1.19.6': resolution: {integrity: sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==} - '@types/brotli@1.3.4': - resolution: {integrity: sha512-cKYjgaS2DMdCKF7R0F5cgx1nfBYObN2ihIuPGQ4/dlIY6RpV7OWNwe9L8V4tTVKL2eZqOkNM9FM/rgTvLf4oXw==} - '@types/chai@5.2.3': resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} @@ -4744,9 +4735,6 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} - brotli@1.3.3: - resolution: {integrity: sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==} - browserify-zlib@0.1.4: resolution: {integrity: sha512-19OEpq7vWgsH6WkvkBJQDFvJS1uPcbFOQ4v9CU839dO+ZZXUZO6XpE6hNCqvlIIj+4fZvRiJ6DsAQ382GwiyTQ==} @@ -11978,14 +11966,14 @@ snapshots: '@graphql-tools/optimize@2.0.0(graphql@16.10.0)': dependencies: graphql: 16.10.0 - tslib: 2.6.3 + tslib: 2.8.1 '@graphql-tools/relay-operation-optimizer@7.0.27(graphql@16.10.0)': dependencies: '@ardatan/relay-compiler': 12.0.3(graphql@16.10.0) '@graphql-tools/utils': 10.7.2(graphql@16.10.0) graphql: 16.10.0 - tslib: 2.6.3 + tslib: 2.8.1 transitivePeerDependencies: - encoding @@ -13753,6 +13741,16 @@ snapshots: '@types/react': 18.3.12 '@types/react-dom': 18.3.7(@types/react@18.3.12) + '@testing-library/react@16.3.2(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@18.3.12))(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + dependencies: + '@babel/runtime': 7.28.6 + '@testing-library/dom': 10.4.1 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + optionalDependencies: + '@types/react': 18.3.12 + '@types/react-dom': 19.2.3(@types/react@18.3.12) + '@theguild/federation-composition@0.21.3(graphql@16.10.0)': dependencies: constant-case: 3.0.4 @@ -13826,10 +13824,6 @@ snapshots: '@types/connect': 3.4.38 '@types/node': 18.19.70 - '@types/brotli@1.3.4': - dependencies: - '@types/node': 18.19.70 - '@types/chai@5.2.3': dependencies: '@types/deep-eql': 4.0.2 @@ -14680,10 +14674,6 @@ snapshots: dependencies: fill-range: 7.1.1 - brotli@1.3.3: - dependencies: - base64-js: 1.5.1 - browserify-zlib@0.1.4: dependencies: pako: 0.2.9 @@ -16871,7 +16861,7 @@ snapshots: is-lower-case@2.0.2: dependencies: - tslib: 2.6.3 + tslib: 2.8.1 is-map@2.0.3: {} @@ -16948,7 +16938,7 @@ snapshots: is-upper-case@2.0.2: dependencies: - tslib: 2.6.3 + tslib: 2.8.1 is-weakmap@2.0.2: {} @@ -17334,7 +17324,7 @@ snapshots: lower-case-first@2.0.2: dependencies: - tslib: 2.6.3 + tslib: 2.8.1 lower-case@2.0.2: dependencies: @@ -18920,7 +18910,7 @@ snapshots: sponge-case@1.0.1: dependencies: - tslib: 2.6.3 + tslib: 2.8.1 sprintf-js@1.0.3: {} @@ -19104,7 +19094,7 @@ snapshots: swap-case@2.0.2: dependencies: - tslib: 2.6.3 + tslib: 2.8.1 symbol-tree@3.2.4: {} @@ -19232,7 +19222,7 @@ snapshots: title-case@3.0.3: dependencies: - tslib: 2.6.3 + tslib: 2.8.1 tldts-core@6.1.86: {}