@shopify/cli-kit 3.80.1 → 3.80.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- export declare const CLI_KIT_VERSION = "3.80.1";
1
+ export declare const CLI_KIT_VERSION = "3.80.2";
@@ -1,2 +1,2 @@
1
- export const CLI_KIT_VERSION = '3.80.1';
1
+ export const CLI_KIT_VERSION = '3.80.2';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/public/common/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.80.1'\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/public/common/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.80.2'\n"]}
@@ -2,7 +2,6 @@ import { relativePath } from './path.js';
2
2
  import { glob, removeFile } from './fs.js';
3
3
  import { outputDebug, outputContent, outputToken } from '../../public/node/output.js';
4
4
  import archiver from 'archiver';
5
- import brotli from 'brotli';
6
5
  import { joinPath } from '@shopify/cli-kit/node/path';
7
6
  import { createWriteStream, readFileSync, writeFileSync } from 'fs';
8
7
  import { tmpdir } from 'os';
@@ -75,6 +74,7 @@ export async function brotliCompress(options) {
75
74
  .catch((error) => reject(error));
76
75
  });
77
76
  const tarContent = readFileSync(tempTarPath);
77
+ const brotli = await import('brotli');
78
78
  const compressed = brotli.compress(tarContent, {
79
79
  quality: 7,
80
80
  mode: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"archiver.js","sourceRoot":"","sources":["../../../src/public/node/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAA;AACtC,OAAO,EAAC,IAAI,EAAE,UAAU,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EAAE;gBACnB,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;oBAClC,MAAM,gBAAgB,GAAG,YAAY,CAAC,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;oBACvE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAC,CAAC,CAAA;gBAClD,CAAC;gBACD,mEAAmE;gBACnE,OAAO,CAAC,QAAQ,EAAE,CAAA;YACpB,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;QACpC,CAAC,CAAC,CAAA;QAEF,MAAM,UAAU,GAAG,YAAY,CAAC,WAAW,CAAC,CAAA;QAC5C,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE;YAC7C,OAAO,EAAE,CAAC;YACV,IAAI,EAAE,CAAC;SACR,CAAC,CAAA;QAEF,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;QAC9C,CAAC;QAED,aAAa,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IAC/C,CAAC;YAAS,CAAC;QACT,IAAI,CAAC;YACH,MAAM,UAAU,CAAC,WAAW,CAAC,CAAA;YAC7B,qDAAqD;QACvD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,aAAa,CAAA,sCAAsC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;QACjG,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import {relativePath} from './path.js'\nimport {glob, removeFile} from './fs.js'\nimport {outputDebug, outputContent, outputToken} from '../../public/node/output.js'\nimport archiver from 'archiver'\nimport brotli from 'brotli'\nimport {joinPath} from '@shopify/cli-kit/node/path'\nimport {createWriteStream, readFileSync, writeFileSync} from 'fs'\nimport {tmpdir} from 'os'\nimport {randomUUID} from 'crypto'\n\ninterface ZipOptions {\n /**\n * The absolute path to the directory to be zipped.\n */\n inputDirectory: string\n\n /**\n * The absolute path to the output zip file.\n */\n outputZipPath: string\n\n /**\n * Pattern(s) to match when adding files to zip, uses glob expressions.\n */\n matchFilePattern?: string | string[]\n}\n\n/**\n * It zips a directory and by default normalizes the paths to be forward-slash.\n * Even with forward-slash paths, zip files should still be able to be opened on\n * Windows.\n *\n * @param options - ZipOptions.\n */\nexport async function zip(options: ZipOptions): Promise<void> {\n const {inputDirectory, outputZipPath, matchFilePattern = '**/*'} = options\n outputDebug(outputContent`Zipping ${outputToken.path(inputDirectory)} into ${outputToken.path(outputZipPath)}`)\n const pathsToZip = await glob(matchFilePattern, {\n cwd: inputDirectory,\n absolute: true,\n dot: true,\n followSymbolicLinks: false,\n })\n\n return new Promise((resolve, reject) => {\n const archive = archiver('zip')\n\n const output = createWriteStream(outputZipPath)\n output.on('close', () => {\n resolve()\n })\n archive.on('error', (error) => {\n reject(error)\n })\n archive.pipe(output)\n\n for (const filePath of pathsToZip) {\n const fileRelativePath = relativePath(inputDirectory, filePath)\n archive.file(filePath, {name: fileRelativePath})\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n archive.finalize()\n })\n}\n\nexport interface BrotliOptions {\n /**\n * The directory to compress.\n */\n inputDirectory: string\n\n /**\n * The path where the compressed file will be saved.\n */\n outputPath: string\n\n /**\n * An optional glob pattern to match files.\n */\n matchFilePattern?: string | string[]\n\n /**\n * Brotli compression level (0-11, default: 11).\n */\n level?: number\n}\n\n/**\n * Options for decompressing a Brotli compressed tar archive.\n */\nexport interface DecompressionOptions {\n /**\n * Path to the compressed file.\n */\n inputFile: string\n\n /**\n * Directory where files should be extracted.\n */\n outputDirectory: string\n}\n\n/**\n * It compresses a directory with Brotli.\n * First creates a tar archive to preserve directory structure,\n * then compresses it with Brotli.\n *\n * @param options - BrotliOptions.\n */\nexport async function brotliCompress(options: BrotliOptions): Promise<void> {\n const tempTarPath = joinPath(tmpdir(), `${randomUUID()}.tar`)\n\n try {\n // Create tar archive using archiver\n await new Promise<void>((resolve, reject) => {\n const archive = archiver('tar')\n const output = createWriteStream(tempTarPath)\n\n output.on('close', () => resolve())\n archive.on('error', (error) => reject(error))\n archive.pipe(output)\n\n glob(options.matchFilePattern ?? '**/*', {\n cwd: options.inputDirectory,\n absolute: true,\n dot: true,\n followSymbolicLinks: false,\n })\n .then((pathsToZip) => {\n for (const filePath of pathsToZip) {\n const fileRelativePath = relativePath(options.inputDirectory, filePath)\n archive.file(filePath, {name: fileRelativePath})\n }\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n archive.finalize()\n })\n .catch((error) => reject(error))\n })\n\n const tarContent = readFileSync(tempTarPath)\n const compressed = brotli.compress(tarContent, {\n quality: 7,\n mode: 0,\n })\n\n if (!compressed) {\n throw new Error('Brotli compression failed')\n }\n\n writeFileSync(options.outputPath, compressed)\n } finally {\n try {\n await removeFile(tempTarPath)\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n outputDebug(outputContent`Failed to clean up temporary file: ${outputToken.path(tempTarPath)}`)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"archiver.js","sourceRoot":"","sources":["../../../src/public/node/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAA;AACtC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,SAAS,CAAA;AACxC,OAAO,EAAC,WAAW,EAAE,aAAa,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAC,QAAQ,EAAC,MAAM,4BAA4B,CAAA;AACnD,OAAO,EAAC,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAC,MAAM,IAAI,CAAA;AACjE,OAAO,EAAC,MAAM,EAAC,MAAM,IAAI,CAAA;AACzB,OAAO,EAAC,UAAU,EAAC,MAAM,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AAC,CAAA;QACpC,CAAC,CAAC,CAAA;QAEF,MAAM,UAAU,GAAG,YAAY,CAAC,WAAW,CAAC,CAAA;QAC5C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;QACrC,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE;YAC7C,OAAO,EAAE,CAAC;YACV,IAAI,EAAE,CAAC;SACR,CAAC,CAAA;QAEF,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;QAC9C,CAAC;QAED,aAAa,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IAC/C,CAAC;YAAS,CAAC;QACT,IAAI,CAAC;YACH,MAAM,UAAU,CAAC,WAAW,CAAC,CAAA;YAC7B,qDAAqD;QACvD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,aAAa,CAAA,sCAAsC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;QACjG,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import {relativePath} from './path.js'\nimport {glob, removeFile} from './fs.js'\nimport {outputDebug, outputContent, outputToken} from '../../public/node/output.js'\nimport archiver from 'archiver'\nimport {joinPath} from '@shopify/cli-kit/node/path'\nimport {createWriteStream, readFileSync, writeFileSync} from 'fs'\nimport {tmpdir} from 'os'\nimport {randomUUID} from 'crypto'\n\ninterface ZipOptions {\n /**\n * The absolute path to the directory to be zipped.\n */\n inputDirectory: string\n\n /**\n * The absolute path to the output zip file.\n */\n outputZipPath: string\n\n /**\n * Pattern(s) to match when adding files to zip, uses glob expressions.\n */\n matchFilePattern?: string | string[]\n}\n\n/**\n * It zips a directory and by default normalizes the paths to be forward-slash.\n * Even with forward-slash paths, zip files should still be able to be opened on\n * Windows.\n *\n * @param options - ZipOptions.\n */\nexport async function zip(options: ZipOptions): Promise<void> {\n const {inputDirectory, outputZipPath, matchFilePattern = '**/*'} = options\n outputDebug(outputContent`Zipping ${outputToken.path(inputDirectory)} into ${outputToken.path(outputZipPath)}`)\n const pathsToZip = await glob(matchFilePattern, {\n cwd: inputDirectory,\n absolute: true,\n dot: true,\n followSymbolicLinks: false,\n })\n\n return new Promise((resolve, reject) => {\n const archive = archiver('zip')\n\n const output = createWriteStream(outputZipPath)\n output.on('close', () => {\n resolve()\n })\n archive.on('error', (error) => {\n reject(error)\n })\n archive.pipe(output)\n\n for (const filePath of pathsToZip) {\n const fileRelativePath = relativePath(inputDirectory, filePath)\n archive.file(filePath, {name: fileRelativePath})\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n archive.finalize()\n })\n}\n\nexport interface BrotliOptions {\n /**\n * The directory to compress.\n */\n inputDirectory: string\n\n /**\n * The path where the compressed file will be saved.\n */\n outputPath: string\n\n /**\n * An optional glob pattern to match files.\n */\n matchFilePattern?: string | string[]\n\n /**\n * Brotli compression level (0-11, default: 11).\n */\n level?: number\n}\n\n/**\n * Options for decompressing a Brotli compressed tar archive.\n */\nexport interface DecompressionOptions {\n /**\n * Path to the compressed file.\n */\n inputFile: string\n\n /**\n * Directory where files should be extracted.\n */\n outputDirectory: string\n}\n\n/**\n * It compresses a directory with Brotli.\n * First creates a tar archive to preserve directory structure,\n * then compresses it with Brotli.\n *\n * @param options - BrotliOptions.\n */\nexport async function brotliCompress(options: BrotliOptions): Promise<void> {\n const tempTarPath = joinPath(tmpdir(), `${randomUUID()}.tar`)\n\n try {\n // Create tar archive using archiver\n await new Promise<void>((resolve, reject) => {\n const archive = archiver('tar')\n const output = createWriteStream(tempTarPath)\n\n output.on('close', () => resolve())\n archive.on('error', (error) => reject(error))\n archive.pipe(output)\n\n glob(options.matchFilePattern ?? '**/*', {\n cwd: options.inputDirectory,\n absolute: true,\n dot: true,\n followSymbolicLinks: false,\n })\n .then((pathsToZip) => {\n for (const filePath of pathsToZip) {\n const fileRelativePath = relativePath(options.inputDirectory, filePath)\n archive.file(filePath, {name: fileRelativePath})\n }\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n archive.finalize()\n })\n .catch((error) => reject(error))\n })\n\n const tarContent = readFileSync(tempTarPath)\n const brotli = await import('brotli')\n const compressed = brotli.compress(tarContent, {\n quality: 7,\n mode: 0,\n })\n\n if (!compressed) {\n throw new Error('Brotli compression failed')\n }\n\n writeFileSync(options.outputPath, compressed)\n } finally {\n try {\n await removeFile(tempTarPath)\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n outputDebug(outputContent`Failed to clean up temporary file: ${outputToken.path(tempTarPath)}`)\n }\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Handles serial processing of items with automatic batching
3
+ * Only one processing operation runs at a time, with new items
4
+ * automatically queued for the next batch.
5
+ */
6
+ export declare class SerialBatchProcessor<T> {
7
+ private readonly processBatch;
8
+ private queue;
9
+ private processingPromise;
10
+ constructor(processBatch: (items: T[]) => Promise<void>);
11
+ enqueue(item: T): void;
12
+ waitForCompletion(): Promise<void>;
13
+ private startProcessing;
14
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Handles serial processing of items with automatic batching
3
+ * Only one processing operation runs at a time, with new items
4
+ * automatically queued for the next batch.
5
+ */
6
+ export class SerialBatchProcessor {
7
+ constructor(processBatch) {
8
+ this.processBatch = processBatch;
9
+ this.queue = [];
10
+ this.processingPromise = undefined;
11
+ }
12
+ enqueue(item) {
13
+ this.queue.push(item);
14
+ if (!this.processingPromise) {
15
+ this.processingPromise = this.startProcessing();
16
+ }
17
+ }
18
+ async waitForCompletion() {
19
+ if (this.processingPromise) {
20
+ return this.processingPromise;
21
+ }
22
+ }
23
+ async startProcessing() {
24
+ try {
25
+ while (this.queue.length > 0) {
26
+ // Get current batch and clear queue
27
+ const batch = [...this.queue];
28
+ this.queue = [];
29
+ // Process the current batch
30
+ // eslint-disable-next-line no-await-in-loop
31
+ await this.processBatch(batch);
32
+ }
33
+ }
34
+ finally {
35
+ // Always make sure we reset the processing state
36
+ this.processingPromise = undefined;
37
+ }
38
+ }
39
+ }
40
+ //# sourceMappingURL=serial-batch-processor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serial-batch-processor.js","sourceRoot":"","sources":["../../../src/public/node/serial-batch-processor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IAI/B,YAA6B,YAA2C;QAA3C,iBAAY,GAAZ,YAAY,CAA+B;QAHhE,UAAK,GAAQ,EAAE,CAAA;QACf,sBAAiB,GAA8B,SAAS,CAAA;IAEW,CAAC;IAE5E,OAAO,CAAC,IAAO;QACb,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAErB,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC5B,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,eAAe,EAAE,CAAA;QACjD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,iBAAiB,CAAA;QAC/B,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,oCAAoC;gBACpC,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;gBAC7B,IAAI,CAAC,KAAK,GAAG,EAAE,CAAA;gBAEf,4BAA4B;gBAC5B,4CAA4C;gBAC5C,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;YAChC,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,iDAAiD;YACjD,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAA;QACpC,CAAC;IACH,CAAC;CACF","sourcesContent":["/**\n * Handles serial processing of items with automatic batching\n * Only one processing operation runs at a time, with new items\n * automatically queued for the next batch.\n */\nexport class SerialBatchProcessor<T> {\n private queue: T[] = []\n private processingPromise: Promise<void> | undefined = undefined\n\n constructor(private readonly processBatch: (items: T[]) => Promise<void>) {}\n\n enqueue(item: T): void {\n this.queue.push(item)\n\n if (!this.processingPromise) {\n this.processingPromise = this.startProcessing()\n }\n }\n\n async waitForCompletion(): Promise<void> {\n if (this.processingPromise) {\n return this.processingPromise\n }\n }\n\n private async startProcessing(): Promise<void> {\n try {\n while (this.queue.length > 0) {\n // Get current batch and clear queue\n const batch = [...this.queue]\n this.queue = []\n\n // Process the current batch\n // eslint-disable-next-line no-await-in-loop\n await this.processBatch(batch)\n }\n } finally {\n // Always make sure we reset the processing state\n this.processingPromise = undefined\n }\n }\n}\n"]}