From aa6d5911d1b0c547ecd6890e0f03cde5dd369a4e Mon Sep 17 00:00:00 2001 From: Julian Benegas Date: Tue, 10 Jun 2025 17:12:47 -0300 Subject: [PATCH 1/4] v --- .changeset/orange-taxis-rule.md | 5 + .changeset/pre.json | 13 +++ packages/basehub/CHANGELOG.md | 6 + packages/basehub/cli.d.ts | 1 + packages/basehub/cli.js | 1 + packages/basehub/package.json | 6 +- packages/basehub/src/cli.ts | 146 +++++++++++++++++++++++++ packages/basehub/tsup-client.config.ts | 36 +++++- playground/CHANGELOG.md | 7 ++ playground/package.json | 2 +- 10 files changed, 219 insertions(+), 4 deletions(-) create mode 100644 .changeset/orange-taxis-rule.md create mode 100644 .changeset/pre.json create mode 100644 packages/basehub/cli.d.ts create mode 100644 packages/basehub/cli.js create mode 100644 packages/basehub/src/cli.ts diff --git a/.changeset/orange-taxis-rule.md b/.changeset/orange-taxis-rule.md new file mode 100644 index 00000000..4b06d42a --- /dev/null +++ b/.changeset/orange-taxis-rule.md @@ -0,0 +1,5 @@ +--- +"basehub": minor +--- + +expose basehub/cli diff --git a/.changeset/pre.json b/.changeset/pre.json new file mode 100644 index 00000000..bcec594c --- /dev/null +++ b/.changeset/pre.json @@ -0,0 +1,13 @@ +{ + "mode": "pre", + "tag": "canary", + "initialVersions": { + "eslint-config-custom": "1.0.0", + "tsconfig": "1.0.0", + "basehub": "8.2.11", + "playground": "0.0.215" + }, + "changesets": [ + "orange-taxis-rule" + ] +} diff --git a/packages/basehub/CHANGELOG.md b/packages/basehub/CHANGELOG.md index 8c01bdff..6ef5a5fa 100644 --- a/packages/basehub/CHANGELOG.md +++ b/packages/basehub/CHANGELOG.md @@ -1,5 +1,11 @@ # basehub +## 8.3.0-canary.0 + +### Minor Changes + +- expose basehub/cli + ## 8.2.11 ### Patch Changes diff --git a/packages/basehub/cli.d.ts b/packages/basehub/cli.d.ts new file mode 100644 index 00000000..d648f18a --- /dev/null +++ b/packages/basehub/cli.d.ts @@ -0,0 +1 @@ +export * from "./dist/cli.d.ts"; diff --git a/packages/basehub/cli.js b/packages/basehub/cli.js new file mode 100644 index 00000000..58997f08 --- /dev/null +++ b/packages/basehub/cli.js @@ -0,0 +1 @@ +export * from "./dist/cli.js"; diff --git a/packages/basehub/package.json b/packages/basehub/package.json index e3d263ed..09fcb0d9 100644 --- a/packages/basehub/package.json +++ b/packages/basehub/package.json @@ -2,7 +2,7 @@ "name": "basehub", "description": "A very fast Headless CMS.", "author": "JB ", - "version": "8.2.11", + "version": "8.3.0-canary.0", "license": "MIT", "repository": "basehub-ai/basehub", "bugs": "https://github.com/basehub-ai/basehub/issues", @@ -46,7 +46,9 @@ "search.js", "search.d.ts", "next-image.js", - "next-image.d.ts" + "next-image.d.ts", + "cli.js", + "cli.d.ts" ], "sideEffects": false, "scripts": { diff --git a/packages/basehub/src/cli.ts b/packages/basehub/src/cli.ts new file mode 100644 index 00000000..4d102933 --- /dev/null +++ b/packages/basehub/src/cli.ts @@ -0,0 +1,146 @@ +import { main } from "./bin/main"; +import { Args } from "./bin/index"; + +export interface GenerateOptions { + /** + * Output directory for the generated client + */ + output?: string; + /** + * BaseHub token (if not provided, will look for BASEHUB_TOKEN env var) + */ + token?: string; + /** + * BaseHub ref to use (branch name or commit ID) + */ + ref?: string; + /** + * Prefix for environment variables + */ + envPrefix?: string; + /** + * Add banner code at the top of each generated file + */ + banner?: string; + /** + * Enable draft mode + */ + draft?: boolean; + /** + * Enable watch mode for automatic regeneration + */ + watch?: boolean; + /** + * API version to use + */ + apiVersion?: string; + /** + * Enable debug logging + */ + debug?: boolean; + /** + * Force draft mode (internal use) + */ + forceDraft?: boolean; + /** + * SDK version (defaults to package version) + */ + version?: string; +} + +/** + * Convert GenerateOptions to CLI Args format + */ +function optionsToArgs(options: GenerateOptions = {}): Args { + const args: Partial = {}; + + if (options.output) args["--output"] = options.output; + if (options.token) args["--token"] = options.token; + if (options.ref) args["--ref"] = options.ref; + if (options.envPrefix) args["--env-prefix"] = options.envPrefix; + if (options.banner) args["--banner"] = options.banner; + if (options.draft) args["--draft"] = true; + if (options.watch) args["--watch"] = true; + if (options.apiVersion) args["--api-version"] = options.apiVersion; + if (options.debug) args["--debug"] = true; + + return args as Args; +} + +/** + * Get the BaseHub package version + */ +function getPackageVersion(): string { + try { + // eslint-disable-next-line @typescript-eslint/no-require-imports + const pkg = require("../package.json"); + return pkg.version; + } catch { + return "unknown"; + } +} + +/** + * Generate BaseHub client code + * + * @param options Configuration options for generation + * @returns Promise that resolves when generation is complete + * + * @example + * ```typescript + * import { generate } from 'basehub/cli' + * + * // Basic usage + * await generate() + * + * // With options + * await generate({ + * output: './my-basehub', + * draft: true, + * watch: false + * }) + * ``` + */ +export async function generate(options: GenerateOptions = {}): Promise { + const version = options.version || getPackageVersion(); + const args = optionsToArgs(options); + const opts = { + version, + ...(options.forceDraft && { forceDraft: true }), + }; + + return main(args, opts); +} + +/** + * Generate BaseHub client in development mode (draft + watch enabled) + * + * @param options Configuration options for generation + * @returns Promise that resolves when generation is complete + * + * @example + * ```typescript + * import { dev } from 'basehub/cli' + * + * // Start development mode + * await dev({ + * output: './my-basehub' + * }) + * ``` + */ +export async function dev(options: GenerateOptions = {}): Promise { + return generate({ + ...options, + watch: true, + forceDraft: true, + }); +} + +/** + * Alias for generate() - builds the BaseHub client + */ +export const build = generate; + +// Re-export types that might be useful +export type { Args } from "./bin/index"; +export type { Options } from "./bin/util/get-stuff-from-env"; diff --git a/packages/basehub/tsup-client.config.ts b/packages/basehub/tsup-client.config.ts index 74559d14..0601862c 100644 --- a/packages/basehub/tsup-client.config.ts +++ b/packages/basehub/tsup-client.config.ts @@ -17,10 +17,44 @@ export default defineConfig((_options: Options) => { "api-transaction": "./src/api-transaction.ts", search: "./src/search/index.ts", "next-image": "./src/next/image/index.ts", + cli: "./src/cli.ts", }, format: ["esm"], splitting: true, - external: ["react", "react-dom", "next"], + external: [ + "react", + "react-dom", + "next", + // Node.js built-ins + "path", + "fs", + "url", + "crypto", + "process", + "os", + "child_process", + "util", + "events", + "stream", + "buffer", + "assert", + "zlib", + "querystring", + "http", + "https", + "net", + "tls", + "dns", + "dgram", + // CLI dependencies that should stay external + "@basehub/genql", + "resolve-pkg", + "esbuild", + "esbuild-scss-modules-plugin", + "dotenv-mono", + "arg", + "zod", + ], plugins: [ { name: "use-client-banner", diff --git a/playground/CHANGELOG.md b/playground/CHANGELOG.md index fdbd05c9..02cf6b03 100644 --- a/playground/CHANGELOG.md +++ b/playground/CHANGELOG.md @@ -1,5 +1,12 @@ # playground +## 0.0.216-canary.0 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.0 + ## 0.0.215 ### Patch Changes diff --git a/playground/package.json b/playground/package.json index 867902b2..f254d674 100644 --- a/playground/package.json +++ b/playground/package.json @@ -1,7 +1,7 @@ { "name": "playground", "private": true, - "version": "0.0.215", + "version": "0.0.216-canary.0", "scripts": { "dev": "basehub dev & next dev --port 3003", "build": "basehub && next build", From 382ea03d3544aa3a387129b83fb8f54e177826ca Mon Sep 17 00:00:00 2001 From: Julian Benegas Date: Tue, 10 Jun 2025 20:05:12 -0300 Subject: [PATCH 2/4] fixes --- .changeset/dull-pans-argue.md | 5 ++++ .changeset/pre.json | 1 + packages/basehub/CHANGELOG.md | 6 +++++ packages/basehub/package.json | 2 +- packages/basehub/tsup-client.config.ts | 35 +------------------------- playground/CHANGELOG.md | 7 ++++++ playground/package.json | 2 +- 7 files changed, 22 insertions(+), 36 deletions(-) create mode 100644 .changeset/dull-pans-argue.md diff --git a/.changeset/dull-pans-argue.md b/.changeset/dull-pans-argue.md new file mode 100644 index 00000000..7419611f --- /dev/null +++ b/.changeset/dull-pans-argue.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +internalize some deps diff --git a/.changeset/pre.json b/.changeset/pre.json index bcec594c..0f470e4e 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -8,6 +8,7 @@ "playground": "0.0.215" }, "changesets": [ + "dull-pans-argue", "orange-taxis-rule" ] } diff --git a/packages/basehub/CHANGELOG.md b/packages/basehub/CHANGELOG.md index 6ef5a5fa..0a645d06 100644 --- a/packages/basehub/CHANGELOG.md +++ b/packages/basehub/CHANGELOG.md @@ -1,5 +1,11 @@ # basehub +## 8.3.0-canary.1 + +### Patch Changes + +- internalize some deps + ## 8.3.0-canary.0 ### Minor Changes diff --git a/packages/basehub/package.json b/packages/basehub/package.json index 09fcb0d9..1c6cfc2f 100644 --- a/packages/basehub/package.json +++ b/packages/basehub/package.json @@ -2,7 +2,7 @@ "name": "basehub", "description": "A very fast Headless CMS.", "author": "JB ", - "version": "8.3.0-canary.0", + "version": "8.3.0-canary.1", "license": "MIT", "repository": "basehub-ai/basehub", "bugs": "https://github.com/basehub-ai/basehub/issues", diff --git a/packages/basehub/tsup-client.config.ts b/packages/basehub/tsup-client.config.ts index 0601862c..c244aa71 100644 --- a/packages/basehub/tsup-client.config.ts +++ b/packages/basehub/tsup-client.config.ts @@ -21,40 +21,7 @@ export default defineConfig((_options: Options) => { }, format: ["esm"], splitting: true, - external: [ - "react", - "react-dom", - "next", - // Node.js built-ins - "path", - "fs", - "url", - "crypto", - "process", - "os", - "child_process", - "util", - "events", - "stream", - "buffer", - "assert", - "zlib", - "querystring", - "http", - "https", - "net", - "tls", - "dns", - "dgram", - // CLI dependencies that should stay external - "@basehub/genql", - "resolve-pkg", - "esbuild", - "esbuild-scss-modules-plugin", - "dotenv-mono", - "arg", - "zod", - ], + external: ["react", "react-dom", "next"], plugins: [ { name: "use-client-banner", diff --git a/playground/CHANGELOG.md b/playground/CHANGELOG.md index 02cf6b03..84adfb07 100644 --- a/playground/CHANGELOG.md +++ b/playground/CHANGELOG.md @@ -1,5 +1,12 @@ # playground +## 0.0.216-canary.1 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.1 + ## 0.0.216-canary.0 ### Patch Changes diff --git a/playground/package.json b/playground/package.json index f254d674..7bdfebcb 100644 --- a/playground/package.json +++ b/playground/package.json @@ -1,7 +1,7 @@ { "name": "playground", "private": true, - "version": "0.0.216-canary.0", + "version": "0.0.216-canary.1", "scripts": { "dev": "basehub dev & next dev --port 3003", "build": "basehub && next build", From 62ab852d5475e0e8c221f97932c3c572d2d9cbd1 Mon Sep 17 00:00:00 2001 From: Julian Benegas Date: Tue, 10 Jun 2025 22:55:24 -0300 Subject: [PATCH 3/4] init --- .changeset/beige-moons-tap.md | 5 + .changeset/bright-clouds-mix.md | 5 + .changeset/bright-needles-beg.md | 5 + .changeset/curly-dragons-dress.md | 5 + .changeset/happy-wombats-sparkle.md | 5 + .changeset/honest-terms-nail.md | 5 + .changeset/lemon-pumpkins-report.md | 5 + .changeset/mighty-gifts-cross.md | 5 + .changeset/odd-spoons-joke.md | 5 + .changeset/pre.json | 17 +- .changeset/proud-brooms-accept.md | 5 + .changeset/rich-ravens-doubt.md | 5 + .changeset/smart-garlics-walk.md | 5 + .changeset/tasty-onions-play.md | 5 + .changeset/violet-geckos-punch.md | 5 + .changeset/wise-dancers-warn.md | 5 + packages/basehub/CHANGELOG.md | 90 +++ packages/basehub/package.json | 11 +- packages/basehub/src/bin/index.ts | 12 + packages/basehub/src/bin/main.ts | 13 +- packages/basehub/src/bin/pack.test.ts | 350 +++++++++++ packages/basehub/src/bin/pack.ts | 460 ++++++++++++++ packages/basehub/src/bin/shared-modules.ts | 29 + packages/basehub/src/cli.ts | 45 ++ packages/basehub/vitest.config.ts | 10 + playground/CHANGELOG.md | 105 ++++ playground/package.json | 2 +- pnpm-lock.yaml | 678 +++++++++++++++++++++ 28 files changed, 1881 insertions(+), 16 deletions(-) create mode 100644 .changeset/beige-moons-tap.md create mode 100644 .changeset/bright-clouds-mix.md create mode 100644 .changeset/bright-needles-beg.md create mode 100644 .changeset/curly-dragons-dress.md create mode 100644 .changeset/happy-wombats-sparkle.md create mode 100644 .changeset/honest-terms-nail.md create mode 100644 .changeset/lemon-pumpkins-report.md create mode 100644 .changeset/mighty-gifts-cross.md create mode 100644 .changeset/odd-spoons-joke.md create mode 100644 .changeset/proud-brooms-accept.md create mode 100644 .changeset/rich-ravens-doubt.md create mode 100644 .changeset/smart-garlics-walk.md create mode 100644 .changeset/tasty-onions-play.md create mode 100644 .changeset/violet-geckos-punch.md create mode 100644 .changeset/wise-dancers-warn.md create mode 100644 packages/basehub/src/bin/pack.test.ts create mode 100644 packages/basehub/src/bin/pack.ts create mode 100644 packages/basehub/src/bin/shared-modules.ts create mode 100644 packages/basehub/vitest.config.ts diff --git a/.changeset/beige-moons-tap.md b/.changeset/beige-moons-tap.md new file mode 100644 index 00000000..56c54afb --- /dev/null +++ b/.changeset/beige-moons-tap.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +. diff --git a/.changeset/bright-clouds-mix.md b/.changeset/bright-clouds-mix.md new file mode 100644 index 00000000..63787ae9 --- /dev/null +++ b/.changeset/bright-clouds-mix.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +asdf diff --git a/.changeset/bright-needles-beg.md b/.changeset/bright-needles-beg.md new file mode 100644 index 00000000..ab7b738f --- /dev/null +++ b/.changeset/bright-needles-beg.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +pack next diff --git a/.changeset/curly-dragons-dress.md b/.changeset/curly-dragons-dress.md new file mode 100644 index 00000000..63787ae9 --- /dev/null +++ b/.changeset/curly-dragons-dress.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +asdf diff --git a/.changeset/happy-wombats-sparkle.md b/.changeset/happy-wombats-sparkle.md new file mode 100644 index 00000000..3e015b54 --- /dev/null +++ b/.changeset/happy-wombats-sparkle.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +fitz diff --git a/.changeset/honest-terms-nail.md b/.changeset/honest-terms-nail.md new file mode 100644 index 00000000..5aa72098 --- /dev/null +++ b/.changeset/honest-terms-nail.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +dsf diff --git a/.changeset/lemon-pumpkins-report.md b/.changeset/lemon-pumpkins-report.md new file mode 100644 index 00000000..95ae269d --- /dev/null +++ b/.changeset/lemon-pumpkins-report.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +pack v0.00001 diff --git a/.changeset/mighty-gifts-cross.md b/.changeset/mighty-gifts-cross.md new file mode 100644 index 00000000..56c54afb --- /dev/null +++ b/.changeset/mighty-gifts-cross.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +. diff --git a/.changeset/odd-spoons-joke.md b/.changeset/odd-spoons-joke.md new file mode 100644 index 00000000..f521556d --- /dev/null +++ b/.changeset/odd-spoons-joke.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +next diff --git a/.changeset/pre.json b/.changeset/pre.json index 0f470e4e..13eb59d4 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -8,7 +8,22 @@ "playground": "0.0.215" }, "changesets": [ + "beige-moons-tap", + "bright-clouds-mix", + "bright-needles-beg", + "curly-dragons-dress", "dull-pans-argue", - "orange-taxis-rule" + "happy-wombats-sparkle", + "honest-terms-nail", + "lemon-pumpkins-report", + "mighty-gifts-cross", + "odd-spoons-joke", + "orange-taxis-rule", + "proud-brooms-accept", + "rich-ravens-doubt", + "smart-garlics-walk", + "tasty-onions-play", + "violet-geckos-punch", + "wise-dancers-warn" ] } diff --git a/.changeset/proud-brooms-accept.md b/.changeset/proud-brooms-accept.md new file mode 100644 index 00000000..63787ae9 --- /dev/null +++ b/.changeset/proud-brooms-accept.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +asdf diff --git a/.changeset/rich-ravens-doubt.md b/.changeset/rich-ravens-doubt.md new file mode 100644 index 00000000..56c54afb --- /dev/null +++ b/.changeset/rich-ravens-doubt.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +. diff --git a/.changeset/smart-garlics-walk.md b/.changeset/smart-garlics-walk.md new file mode 100644 index 00000000..9fbdf7f9 --- /dev/null +++ b/.changeset/smart-garlics-walk.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +sd: diff --git a/.changeset/tasty-onions-play.md b/.changeset/tasty-onions-play.md new file mode 100644 index 00000000..56c54afb --- /dev/null +++ b/.changeset/tasty-onions-play.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +. diff --git a/.changeset/violet-geckos-punch.md b/.changeset/violet-geckos-punch.md new file mode 100644 index 00000000..56c54afb --- /dev/null +++ b/.changeset/violet-geckos-punch.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +. diff --git a/.changeset/wise-dancers-warn.md b/.changeset/wise-dancers-warn.md new file mode 100644 index 00000000..56c54afb --- /dev/null +++ b/.changeset/wise-dancers-warn.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +. diff --git a/packages/basehub/CHANGELOG.md b/packages/basehub/CHANGELOG.md index 0a645d06..288ed0b6 100644 --- a/packages/basehub/CHANGELOG.md +++ b/packages/basehub/CHANGELOG.md @@ -1,5 +1,95 @@ # basehub +## 8.3.0-canary.16 + +### Patch Changes + +- sd: + +## 8.3.0-canary.15 + +### Patch Changes + +- . + +## 8.3.0-canary.14 + +### Patch Changes + +- dsf + +## 8.3.0-canary.13 + +### Patch Changes + +- . + +## 8.3.0-canary.12 + +### Patch Changes + +- asdf + +## 8.3.0-canary.11 + +### Patch Changes + +- . + +## 8.3.0-canary.10 + +### Patch Changes + +- asdf + +## 8.3.0-canary.9 + +### Patch Changes + +- . + +## 8.3.0-canary.8 + +### Patch Changes + +- asdf + +## 8.3.0-canary.7 + +### Patch Changes + +- . + +## 8.3.0-canary.6 + +### Patch Changes + +- . + +## 8.3.0-canary.5 + +### Patch Changes + +- fitz + +## 8.3.0-canary.4 + +### Patch Changes + +- next + +## 8.3.0-canary.3 + +### Patch Changes + +- pack next + +## 8.3.0-canary.2 + +### Patch Changes + +- pack v0.00001 + ## 8.3.0-canary.1 ### Patch Changes diff --git a/packages/basehub/package.json b/packages/basehub/package.json index 1c6cfc2f..2da19a74 100644 --- a/packages/basehub/package.json +++ b/packages/basehub/package.json @@ -2,7 +2,7 @@ "name": "basehub", "description": "A very fast Headless CMS.", "author": "JB ", - "version": "8.3.0-canary.1", + "version": "8.3.0-canary.16", "license": "MIT", "repository": "basehub-ai/basehub", "bugs": "https://github.com/basehub-ai/basehub/issues", @@ -56,7 +56,9 @@ "dev": "pnpm emit-dts && pnpm build --watch", "build": "pnpm build:bin && pnpm build:client", "build:bin": "pnpm emit-dts && tsup --config tsup-bin.config.ts", - "build:client": "tsup --config tsup-client.config.ts" + "build:client": "tsup --config tsup-client.config.ts", + "test": "vitest", + "test:run": "vitest run" }, "dependencies": { "@basehub/genql": "9.0.0-canary.13", @@ -85,14 +87,17 @@ "@types/node": "18.13.0", "@types/react": "18.2.20", "@types/react-dom": "18.2.7", + "@types/tar": "^6.1.5", "dts-bundle-generator": "^9.5.1", "esbuild-scss-modules-plugin": "^1.1.1", "next": "^13.5.3", "pkg-pr-new": "^0.0.30", "react": "18.2.0", "react-dom": "18.2.0", + "tar": "^6.2.0", "tsconfig": "workspace:*", "tsup": "8.0.2", - "type-fest": "3.0.0" + "type-fest": "3.0.0", + "vitest": "^0.32.3" } } diff --git a/packages/basehub/src/bin/index.ts b/packages/basehub/src/bin/index.ts index 9ad3f077..7d5bef19 100644 --- a/packages/basehub/src/bin/index.ts +++ b/packages/basehub/src/bin/index.ts @@ -2,6 +2,7 @@ import arg from "arg"; import { main } from "./main"; +import { pack } from "./pack"; import { formatError } from "./util/format-error"; import fs from "fs"; import resolvePkg from "resolve-pkg"; @@ -25,6 +26,7 @@ async function help(code: number) { Usage $ basehub $ basehub dev # turns on draft and watch mode automatically. + $ basehub pack # creates a standalone tarball of the generated client. Options --output, -o Output directory, if you don't want the default behavior. @@ -33,6 +35,8 @@ async function help(code: number) { --watch, -w Watch for changes and regenerate. --draft, -d Generate with draft mode enabled. --api-version, -av The version of the API to use. + --pack-dest, -pd Directory to place the tarball (pack command only). + --keep-generated, -kg Keep the generated client directory after packing. --version, -v Version number. --help, -h Display this message.`); process.exit(code); @@ -61,6 +65,8 @@ const args = arg( "--watch": Boolean, "--api-version": String, "--debug": Boolean, + "--pack-dest": String, + "--keep-generated": Boolean, // aliases "-o": "--output", "-t": "--token", @@ -72,6 +78,8 @@ const args = arg( "-h": "--help", "-w": "--watch", "-av": "--api-version", + "-pd": "--pack-dest", + "-kg": "--keep-generated", }, { permissive: true } ); @@ -88,6 +96,10 @@ const cmds: { [key: string]: (args: Args) => Promise } = { generate: () => main(args, { version }), build: () => main(args, { version }), // same as "generate" dev: () => main({ ...args, "--watch": true }, { forceDraft: true, version }), + pack: async () => { + const _tarballPath = await pack(args, { version }); + // Don't print the path again as it's already logged in the pack function + }, help: () => help(0), }; diff --git a/packages/basehub/src/bin/main.ts b/packages/basehub/src/bin/main.ts index e2127049..eae3fd9a 100644 --- a/packages/basehub/src/bin/main.ts +++ b/packages/basehub/src/bin/main.ts @@ -17,6 +17,7 @@ import { createHash } from "crypto"; import { ResolvedRef } from "../common-types"; import { ensureCrossPlatformTsImport } from "./util/cross-platform-ts-imports"; import { ensureSingleInstance } from "./util/ensure-single-instance"; +import { BASEHUB_MODULES } from "./shared-modules"; const buildManifestSchema = z.object({ generatedAt: z.string(), @@ -465,17 +466,7 @@ import type { Language as B_Language } from './react-code-block'; if (output !== "node_modules") { // alias react-rich-text and other packages to the generated client for better import experience - [ - "react-svg", - "react-rich-text", - "react-form", - "react-code-block/index", - "react-code-block/client", - "api-transaction", - "react-search", - "search", - "next-image", - ].map((pathsToAlias) => { + BASEHUB_MODULES.map((pathsToAlias) => { // ensure the directory exists fs.mkdirSync( path.join(basehubOutputPath, ...pathsToAlias.split("/").slice(0, -1)), diff --git a/packages/basehub/src/bin/pack.test.ts b/packages/basehub/src/bin/pack.test.ts new file mode 100644 index 00000000..7765ea40 --- /dev/null +++ b/packages/basehub/src/bin/pack.test.ts @@ -0,0 +1,350 @@ +import { describe, it, expect, beforeAll, afterAll } from "vitest"; +import { pack } from "../cli"; +import fs from "fs"; +import path from "path"; +import tar from "tar"; +import { tmpdir } from "os"; + +describe("pack functionality", () => { + const testToken = + "bshb_pk_97ptgy92152bc09433y1461rww6hn6vzuvoxgd8bbef0i14zfx0lzf3vz1n79z71"; + let testDir: string; + let tarballPath: string; + let extractedDir: string; + + beforeAll(async () => { + // Create a unique test directory + testDir = path.join(tmpdir(), `basehub-pack-test-${Date.now()}`); + fs.mkdirSync(testDir, { recursive: true }); + + console.log(`๐Ÿงช Running pack test in: ${testDir}`); + + // Set up extraction directory + extractedDir = path.join(testDir, "extracted"); + fs.mkdirSync(extractedDir, { recursive: true }); + }); + + afterAll(async () => { + // Clean up test directory + if (fs.existsSync(testDir)) { + fs.rmSync(testDir, { recursive: true, force: true }); + } + }); + + it("should generate a tarball successfully", async () => { + console.log("๐Ÿ“ฆ Testing pack generation..."); + + const result = await pack({ + token: testToken, + output: path.join(testDir, "generated-client"), + packDest: testDir, + keepGenerated: true, // Keep for inspection + }); + + expect(result).toBeDefined(); + expect(typeof result).toBe("string"); + + tarballPath = result; + + // Check if tarball exists + expect(fs.existsSync(tarballPath)).toBe(true); + + // Check tarball has reasonable size (should be at least 50KB) + const stats = fs.statSync(tarballPath); + expect(stats.size).toBeGreaterThan(50 * 1024); // At least 50KB + expect(stats.size).toBeLessThan(50 * 1024 * 1024); // Less than 50MB + + console.log( + `โœ… Tarball created: ${tarballPath} (${(stats.size / 1024).toFixed( + 2 + )} KB)` + ); + }); + + it("should extract tarball correctly", async () => { + expect(tarballPath).toBeDefined(); + + console.log("๐Ÿ“ค Testing tarball extraction..."); + + // Extract the tarball + await tar.extract({ + file: tarballPath, + cwd: extractedDir, + }); + + console.log("โœ… Tarball extracted successfully"); + + // Check that package.json exists in the extracted content + const packageJsonPath = path.join(extractedDir, "package.json"); + expect(fs.existsSync(packageJsonPath)).toBe(true); + + // Parse and validate package.json + const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8")); + expect(packageJson.name).toBe("basehub"); + expect(packageJson.version).toBe("1.0.0"); // Hardcoded version + expect(packageJson.main).toBe("./index.js"); // Actual format used + expect(packageJson.types).toBe("./index.d.ts"); // Actual format used + }); + + it("should have correct file structure", async () => { + console.log("๐Ÿ” Testing file structure..."); + + // Core files should exist + const coreFiles = [ + "index.js", + "index.ts", // The source TypeScript file should exist + "schema.ts", + "package.json", + ]; + + for (const file of coreFiles) { + const filePath = path.join(extractedDir, file); + expect(fs.existsSync(filePath)).toBe(true); + } + + // Bundled directory should exist + const bundledDir = path.join(extractedDir, "bundled"); + expect(fs.existsSync(bundledDir)).toBe(true); + + console.log("โœ… File structure is correct"); + }); + + it("should have working import resolution", async () => { + console.log("๐Ÿ”— Testing import resolution..."); + + // Check that root level files import from bundled correctly + const indexJsPath = path.join(extractedDir, "index.js"); + const indexContent = fs.readFileSync(indexJsPath, "utf-8"); + + // Should not have any basehub/* imports (they should be replaced) + expect(indexContent).not.toMatch(/from\s+['"]basehub\//); + expect(indexContent).not.toMatch(/import.*['"]basehub\//); + + // If there are imports, they should be using relative paths + if (indexContent.includes("import") || indexContent.includes("from")) { + console.log( + "โœ… Index file has proper relative imports (no basehub/* imports found)" + ); + } else { + console.log("โœ… Index file has no imports to check"); + } + + console.log("โœ… Import resolution is working"); + }); + + it("should have proper TypeScript declarations", async () => { + console.log("๐Ÿ“ Testing TypeScript declarations..."); + + // Check main index.ts (source file) + const indexTsPath = path.join(extractedDir, "index.ts"); + const indexTsContent = fs.readFileSync(indexTsPath, "utf-8"); + + // Should have substantial content + expect(indexTsContent.length).toBeGreaterThan(100); + + // Check schema.ts exists and has content + const schemaPath = path.join(extractedDir, "schema.ts"); + const schemaContent = fs.readFileSync(schemaPath, "utf-8"); + expect(schemaContent.length).toBeGreaterThan(1000); // Should be substantial + + console.log("โœ… TypeScript declarations are present"); + }); + + it("should contain basehub modules in bundled structure", async () => { + console.log("๐Ÿ“š Testing bundled modules..."); + + const bundledDir = path.join(extractedDir, "bundled"); + const bundledDistDir = path.join(extractedDir, "bundled", "dist"); + + expect(fs.existsSync(bundledDir)).toBe(true); + expect(fs.existsSync(bundledDistDir)).toBe(true); + + // Check for some key modules that should have wrapper files at bundled level + const expectedModules = [ + "react-rich-text.js", + "react-rich-text.d.ts", + "api-transaction.d.ts", + "search.js", + "search.d.ts", + ]; + + for (const moduleFile of expectedModules) { + // Check wrapper file at bundled level + const wrapperPath = path.join(bundledDir, moduleFile); + if (fs.existsSync(wrapperPath)) { + const wrapperContent = fs.readFileSync(wrapperPath, "utf-8"); + + // Check if wrapper uses correct relative path to dist + const isNestedModule = moduleFile.includes("/"); + if (isNestedModule) { + expect(wrapperContent).toMatch(/export \* from "\.\.\/dist\//); + console.log( + `โœ… ${moduleFile} wrapper correctly points to ../dist/ (nested)` + ); + } else { + expect(wrapperContent).toMatch(/export \* from "\.\/dist\//); + console.log( + `โœ… ${moduleFile} wrapper correctly points to ./dist/ (root)` + ); + } + } + + // Check actual file in bundled/dist + const distPath = path.join(bundledDistDir, moduleFile); + if (fs.existsSync(distPath)) { + const distContent = fs.readFileSync(distPath, "utf-8"); + expect(distContent.length).toBeGreaterThan(0); + console.log(`โœ… ${moduleFile} exists in bundled/dist/`); + } + } + + console.log("โœ… Bundled modules structure verified"); + }); + + it("should have correct import paths in bundled files", async () => { + console.log("๐Ÿ”— Testing bundled file import paths..."); + + const bundledDistDir = path.join(extractedDir, "bundled", "dist"); + + // Check bundled files for correct import paths (should preserve original dist structure) + if (fs.existsSync(bundledDistDir)) { + const bundledFiles = fs + .readdirSync(bundledDistDir) + .filter((f) => f.endsWith(".js")); + + for (const file of bundledFiles) { + // Files in bundled/dist should preserve their original import structure + // No need to check for specific import patterns since we copied the entire dist + console.log( + `โœ… ${file} preserved in bundled/dist with original imports` + ); + } + } + + console.log("โœ… All bundled files maintain their original structure"); + }); + + it("should fix circular dependencies in entrypoint files", async () => { + console.log("๐Ÿ”„ Testing entrypoint files for circular dependencies..."); + + // Check key entrypoint files at root level for circular dependency issues + const entrypointFiles = [ + "react-rich-text.js", + "react-rich-text.d.ts", + "next-image.js", + "next-image.d.ts", + "search.js", + "search.d.ts", + ]; + + for (const fileName of entrypointFiles) { + const filePath = path.join(extractedDir, fileName); + if (fs.existsSync(filePath)) { + const content = fs.readFileSync(filePath, "utf-8"); + + // Should NOT import from "basehub/" (would cause circular dependency) + expect(content).not.toMatch(/from\s+['"]basehub\//); + expect(content).not.toMatch(/export\s+\*\s+from\s+['"]basehub\//); + + // Should import from correct relative path to bundled (accounting for nesting) + if (content.includes("export * from") || content.includes("from")) { + // For nested files like react-code-block/index.js, should use ../bundled/ + // For root level files, should use ./bundled/ + const shouldUseParentPath = fileName.includes("/"); + if (shouldUseParentPath) { + expect(content).toMatch(/['"]\.\.\/bundled\//); + console.log( + `โœ… ${fileName} correctly imports from "../bundled/" (nested)` + ); + } else { + expect(content).toMatch(/['"]\.\/bundled\//); + console.log( + `โœ… ${fileName} correctly imports from "./bundled/" (root)` + ); + } + } + } + } + + console.log("โœ… All entrypoint files have correct non-circular imports"); + }); + + it("should fix incorrect relative imports in dist files", async () => { + console.log("๐Ÿ”ง Testing import fixes in dist files..."); + + const bundledDistDir = path.join(extractedDir, "bundled", "dist"); + + if (fs.existsSync(bundledDistDir)) { + const distFiles = fs + .readdirSync(bundledDistDir) + .filter((f) => f.endsWith(".js")); + + for (const file of distFiles) { + const filePath = path.join(bundledDistDir, file); + const content = fs.readFileSync(filePath, "utf-8"); + + // Should not have incorrect relative imports that would break + expect(content).not.toMatch(/from\s+['"]\.\/bundled\//); // Should be ../../bundled/ + expect(content).not.toMatch(/from\s+['"]\.\/dist\/\.\.\//); // Should be cleaned up + + console.log(`โœ… ${file} has correct relative imports`); + } + } + + console.log("โœ… All dist files have properly fixed imports"); + }); + + it("should warn about external dependencies", async () => { + console.log("โš ๏ธ Testing external dependency detection..."); + + // This test mainly checks that the pack function completes without throwing + // External dependency warnings would be shown in console output + // In real usage, users would need to ensure these deps are available + + expect(tarballPath).toBeDefined(); + console.log( + "โœ… External dependency detection completed (check console warnings)" + ); + }); + + it("should include external dependencies in package.json", async () => { + console.log("๐Ÿ“ฆ Testing package.json dependencies..."); + + const packageJsonPath = path.join(extractedDir, "package.json"); + expect(fs.existsSync(packageJsonPath)).toBe(true); + + const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8")); + + // Should have dependencies for external packages + expect(packageJson.dependencies).toBeDefined(); + + // Check for known external dependencies that are used in basehub modules + const expectedDeps = [ + "github-slugger", + "shiki", + "@radix-ui/react-slot", + "@shikijs/transformers", + "@xmldom/xmldom", + "github-slugger", + "hast-util-to-jsx-runtime", + "lodash.debounce", + "lodash.get", + "pusher-js", + "server-only", + "shiki", + "typesense", + "zod", + ]; + for (const dep of expectedDeps) { + if (packageJson.dependencies[dep]) { + console.log( + `โœ… Found dependency: ${dep}@${packageJson.dependencies[dep]}` + ); + } else { + console.log(`โš ๏ธ Dependency ${dep} not found in package.json`); + } + } + + console.log("โœ… Package.json dependencies verified"); + }); +}); diff --git a/packages/basehub/src/bin/pack.ts b/packages/basehub/src/bin/pack.ts new file mode 100644 index 00000000..50899b2d --- /dev/null +++ b/packages/basehub/src/bin/pack.ts @@ -0,0 +1,460 @@ +import { main } from "./main"; +import { Args } from "./index"; +import { ALL_PACK_MODULES } from "./shared-modules"; +import fs from "fs"; +import path from "path"; +import { exec } from "child_process"; +import { promisify } from "util"; + +const execAsync = promisify(exec); + +export const pack = async ( + args: Args, + opts: { version: string } +): Promise => { + console.log("๐Ÿ“ฆ Starting pack process..."); + + // Step 1: Generate the client first + console.log("๐Ÿช„ Generating BaseHub client..."); + await main(args, opts); + + // Determine output directory + const outputDir = args["--output"] || ".basehub"; + const basehubOutputPath = path.resolve(process.cwd(), outputDir); + + if (!fs.existsSync(basehubOutputPath)) { + throw new Error(`Generated client not found at: ${basehubOutputPath}`); + } + + // Step 2: Create standalone bundle + console.log("๐Ÿ“ฆ Creating standalone bundle..."); + const standaloneDir = path.join(basehubOutputPath, "standalone"); + fs.mkdirSync(standaloneDir, { recursive: true }); + + // Bundle the generated client into a standalone version + await bundleStandalone(basehubOutputPath, standaloneDir, "1.0.0"); + + // Step 3: Create tarball + console.log("๐Ÿ—œ๏ธ Creating tarball..."); + const packDest = args["--pack-dest"] || process.cwd(); + + let tarballPath: string; + try { + tarballPath = await createTarball( + standaloneDir, + "1.0.0", // Hard-coded version + packDest + ); + } finally { + // Step 4: Cleanup (unless user wants to keep generated client) + if (!args["--keep-generated"]) { + console.log("๐Ÿงน Cleaning up generated client directory..."); + try { + fs.rmSync(basehubOutputPath, { recursive: true, force: true }); + console.log("โœ… Cleanup complete"); + } catch (error) { + console.warn( + `โš ๏ธ Warning: Could not clean up ${basehubOutputPath}:`, + error + ); + } + } else { + console.log(`๐Ÿ“ Generated client directory kept: ${basehubOutputPath}`); + } + } + + console.log(`โœ… Pack complete! Tarball created: ${tarballPath}`); + return tarballPath; +}; + +async function bundleStandalone( + sourcePath: string, + targetPath: string, + version: string +): Promise { + // Read the generated index files + const indexTsPath = path.join(sourcePath, "index.ts"); + const indexJsPath = path.join(sourcePath, "index.js"); + + let indexTsContent = fs.readFileSync(indexTsPath, "utf-8"); + let indexJsContent = fs.existsSync(indexJsPath) + ? fs.readFileSync(indexJsPath, "utf-8") + : indexTsContent; // fallback to TS if JS doesn't exist + + // Replace all imports from "basehub/*" with relative imports in both files + // This prevents circular dependencies when the tarball is named "basehub" + indexTsContent = indexTsContent.replace( + /from\s+["']basehub\/([^"']+)["']/g, + 'from "./bundled/$1"' + ); + indexJsContent = indexJsContent.replace( + /from\s+["']basehub\/([^"']+)["']/g, + 'from "./bundled/$1"' + ); + + // Also handle export statements in both files + indexTsContent = indexTsContent.replace( + /export\s+\*\s+from\s+["']basehub\/([^"']+)["']/g, + 'export * from "./bundled/$1"' + ); + indexJsContent = indexJsContent.replace( + /export\s+\*\s+from\s+["']basehub\/([^"']+)["']/g, + 'export * from "./bundled/$1"' + ); + + // Create bundled directory for dependencies + const bundledDir = path.join(targetPath, "bundled"); + fs.mkdirSync(bundledDir, { recursive: true }); + + // Copy all the generated files + copyDirRecursive(sourcePath, targetPath, ["standalone", "node_modules"]); + + // Bundle common dependencies that were imported from "basehub" + await bundleBasehubDependencies(bundledDir); + + // Fix imports in the copied dist files + await fixDistImports(bundledDir); + + // Write the modified index files + fs.writeFileSync(path.join(targetPath, "index.ts"), indexTsContent); + fs.writeFileSync(path.join(targetPath, "index.js"), indexJsContent); + + // Fix imports in all BASEHUB_MODULES entrypoint files + await fixEntrypointImports(targetPath); + + // Read basehub package.json for dependency versions + const basehubModulePath = require("resolve-pkg")("basehub"); + let basehubDependencies = {}; + + const basehubPkgJsonPath = path.join(basehubModulePath, "package.json"); + const basehubPkgJson = JSON.parse( + fs.readFileSync(basehubPkgJsonPath, "utf-8") + ); + + // Extract only the external dependencies we know are needed + const externalDeps = [ + "github-slugger", + "shiki", + "@radix-ui/react-slot", + "@shikijs/transformers", + "@xmldom/xmldom", + "github-slugger", + "hast-util-to-jsx-runtime", + "lodash.debounce", + "lodash.get", + "pusher-js", + "server-only", + "shiki", + "typesense", + "zod", + ]; + basehubDependencies = Object.fromEntries( + externalDeps + .filter( + (dep) => + basehubPkgJson.dependencies?.[dep] || + basehubPkgJson.devDependencies?.[dep] + ) + .map((dep) => [ + dep, + basehubPkgJson.dependencies?.[dep] || + basehubPkgJson.devDependencies?.[dep], + ]) + ); + + console.log(`โœ… Found external dependencies:`, basehubDependencies); + + // Create package.json for the standalone version + const packageJson = { + version, + name: "basehub", + main: "./index.js", + types: "./index.d.ts", + exports: { + ".": { + import: "./index.js", + require: "./index.js", + types: "./index.d.ts", + }, + "./*": "./*", + }, + sideEffects: false, + files: ["**/*"], + dependencies: basehubDependencies, + peerDependencies: {}, + }; + + fs.writeFileSync( + path.join(targetPath, "package.json"), + JSON.stringify(packageJson, null, 2) + ); + + console.log("โœ… Standalone bundle created"); +} + +async function bundleBasehubDependencies(bundledDir: string): Promise { + // Get the basehub module path to access dist files + const basehubModulePath = require("resolve-pkg")("basehub"); + + if (!basehubModulePath) { + throw new Error("Could not resolve basehub module path"); + } + + const distDir = path.join(basehubModulePath, "dist"); + const bundledDistDir = path.join(bundledDir, "dist"); + + // Copy the entire dist directory to bundled/dist/ + // This preserves all internal imports and file structure + if (fs.existsSync(distDir)) { + copyDirRecursive(distDir, bundledDistDir); + console.log("โœ… Copied dist directory to bundled/dist/"); + } else { + console.warn(`โš ๏ธ Warning: dist directory not found at ${distDir}`); + } + + // Create bundled wrapper files that point to correct relative path to dist/moduleName + for (const moduleName of ALL_PACK_MODULES) { + const bundledJsPath = path.join(bundledDir, `${moduleName}.js`); + const bundledDtsPath = path.join(bundledDir, `${moduleName}.d.ts`); + + // Calculate correct relative path from bundled wrapper to dist directory + const moduleDepth = moduleName.split("/").length - 1; + const distRelativePath = + moduleDepth > 0 ? "../".repeat(moduleDepth) + "dist" : "./dist"; + + // Ensure nested directory structure exists + fs.mkdirSync(path.dirname(bundledJsPath), { recursive: true }); + + // Create JS wrapper that points to correct dist path + fs.writeFileSync( + bundledJsPath, + `export * from "${distRelativePath}/${moduleName}";\n` + ); + + // Create TypeScript declaration wrapper + fs.writeFileSync( + bundledDtsPath, + `export * from "${distRelativePath}/${moduleName}";\n` + ); + + console.log( + `โœ… Created bundled wrapper: ${moduleName} (using ${distRelativePath})` + ); + } + + console.log("โœ… Created bundled wrapper files pointing to ./dist/"); +} + +async function fixDistImports(bundledDir: string): Promise { + const bundledDistDir = path.join(bundledDir, "dist"); + + if (!fs.existsSync(bundledDistDir)) { + console.warn("โš ๏ธ bundled/dist directory not found, skipping import fixes"); + return; + } + + // Get all JS and TS files in the dist directory + const distFiles = getAllFilesRecursively(bundledDistDir, [".js", ".d.ts"]); + + for (const filePath of distFiles) { + try { + let content = fs.readFileSync(filePath, "utf-8"); + let modified = false; + + // Fix relative imports that are incorrect due to the new directory structure + // Replace ./bundled/ with ../../bundled/ (going up from bundled/dist/ to root) + if (content.includes("./bundled/")) { + content = content.replace( + /from\s+["']\.\/bundled\/([^"']+)["']/g, + 'from "../../bundled/$1"' + ); + content = content.replace( + /export\s+\*\s+from\s+["']\.\/bundled\/([^"']+)["']/g, + 'export * from "../../bundled/$1"' + ); + modified = true; + } + + // Fix ./dist/ imports to be relative within the dist directory + if (content.includes("./dist/")) { + content = content.replace( + /from\s+["']\.\/dist\/([^"']+)["']/g, + 'from "./$1"' + ); + content = content.replace( + /export\s+\*\s+from\s+["']\.\/dist\/([^"']+)["']/g, + 'export * from "./$1"' + ); + modified = true; + } + + // Handle external dependencies that need to be resolved + // For now, let's identify and warn about them + const externalImports = findExternalImports(content); + if (externalImports.length > 0) { + console.warn( + `โš ๏ธ External dependencies found in ${path.relative( + bundledDistDir, + filePath + )}: ${externalImports.join(", ")}` + ); + console.warn( + " These may need to be installed separately or bundled." + ); + } + + if (modified) { + fs.writeFileSync(filePath, content); + } + } catch (error) { + console.warn(`โš ๏ธ Failed to fix imports in ${filePath}:`, error); + } + } + + console.log("โœ… Fixed imports in bundled/dist files"); +} + +function getAllFilesRecursively(dir: string, extensions: string[]): string[] { + const files: string[] = []; + + function traverse(currentDir: string) { + const items = fs.readdirSync(currentDir); + + for (const item of items) { + const fullPath = path.join(currentDir, item); + const stat = fs.statSync(fullPath); + + if (stat.isDirectory()) { + traverse(fullPath); + } else if (extensions.some((ext) => item.endsWith(ext))) { + files.push(fullPath); + } + } + } + + traverse(dir); + return files; +} + +function findExternalImports(content: string): string[] { + const externalImports: string[] = []; + + // Find all import/export statements + const importRegex = /(?:import|export).*?from\s+["']([^"']+)["']/g; + let match; + + while ((match = importRegex.exec(content)) !== null) { + const importPath = match[1]; + + // Check if importPath exists and is an external package (not relative import) + if ( + importPath && + !importPath.startsWith(".") && + !importPath.startsWith("/") + ) { + // Known external dependencies that might cause issues + const problematicDeps = ["github-slugger", "shiki", "react", "react-dom"]; + if (problematicDeps.includes(importPath)) { + externalImports.push(importPath); + } + } + } + + return [...new Set(externalImports)]; // Remove duplicates +} + +async function fixEntrypointImports(targetPath: string): Promise { + // Fix imports in all BASEHUB_MODULES entrypoint files that were copied from the generated client + for (const moduleName of ALL_PACK_MODULES) { + const jsFile = path.join(targetPath, `${moduleName}.js`); + const dtsFile = path.join(targetPath, `${moduleName}.d.ts`); + + // Calculate the correct relative path to bundled directory + // Count how many directories deep this module is + const moduleDepth = moduleName.split("/").length - 1; + const relativePath = + moduleDepth > 0 ? "../".repeat(moduleDepth) + "bundled" : "./bundled"; + + // Fix JS file imports - use correct relative path to bundled + if (fs.existsSync(jsFile)) { + let content = fs.readFileSync(jsFile, "utf-8"); + + // Replace "basehub/..." with correct relative path to bundled + content = content.replace( + /from\s+["']basehub\/([^"']+)["']/g, + `from "${relativePath}/$1"` + ); + content = content.replace( + /export\s+\*\s+from\s+["']basehub\/([^"']+)["']/g, + `export * from "${relativePath}/$1"` + ); + + fs.writeFileSync(jsFile, content); + console.log( + `โœ… Fixed entrypoint imports in: ${moduleName}.js (using ${relativePath})` + ); + } + + // Fix TypeScript declaration file imports + if (fs.existsSync(dtsFile)) { + let content = fs.readFileSync(dtsFile, "utf-8"); + + // Replace "basehub/..." with correct relative path to bundled + content = content.replace( + /from\s+["']basehub\/([^"']+)["']/g, + `from "${relativePath}/$1"` + ); + content = content.replace( + /export\s+\*\s+from\s+["']basehub\/([^"']+)["']/g, + `export * from "${relativePath}/$1"` + ); + + fs.writeFileSync(dtsFile, content); + console.log( + `โœ… Fixed entrypoint imports in: ${moduleName}.d.ts (using ${relativePath})` + ); + } + } +} + +function copyDirRecursive( + src: string, + dest: string, + exclude: string[] = [] +): void { + if (!fs.existsSync(dest)) { + fs.mkdirSync(dest, { recursive: true }); + } + + const items = fs.readdirSync(src); + + for (const item of items) { + if (exclude.includes(item)) continue; + + const srcPath = path.join(src, item); + const destPath = path.join(dest, item); + + if (fs.statSync(srcPath).isDirectory()) { + copyDirRecursive(srcPath, destPath, exclude); + } else { + fs.copyFileSync(srcPath, destPath); + } + } +} + +async function createTarball( + standaloneDir: string, + version: string, + packDest: string +): Promise { + const tarballName = `basehub-${version}.tgz`; + const tarballPath = path.resolve(packDest, tarballName); + + // Ensure pack destination directory exists + fs.mkdirSync(packDest, { recursive: true }); + + // Create tarball using tar command + await execAsync(`cd "${standaloneDir}" && tar -czf "${tarballPath}" .`); + + return tarballPath; +} diff --git a/packages/basehub/src/bin/shared-modules.ts b/packages/basehub/src/bin/shared-modules.ts new file mode 100644 index 00000000..2f74d1fc --- /dev/null +++ b/packages/basehub/src/bin/shared-modules.ts @@ -0,0 +1,29 @@ +/** + * Shared list of modules that need to be handled consistently + * between generation and packing + */ +export const BASEHUB_MODULES = [ + "react-svg", + "react-rich-text", + "react-form", + "react-code-block/index", + "react-code-block/client", + "api-transaction", + "react-search", + "search", + "next-image", +] as const; + +/** + * Additional modules that are only needed for packing + * (not aliased in regular generation) + */ +export const PACK_ONLY_MODULES = ["react-icon", "events", "workflows"] as const; + +/** + * All modules that need to be bundled during packing + */ +export const ALL_PACK_MODULES = [ + ...BASEHUB_MODULES, + ...PACK_ONLY_MODULES, +] as const; diff --git a/packages/basehub/src/cli.ts b/packages/basehub/src/cli.ts index 4d102933..aa4d2f03 100644 --- a/packages/basehub/src/cli.ts +++ b/packages/basehub/src/cli.ts @@ -1,4 +1,5 @@ import { main } from "./bin/main"; +import { pack as packCommand } from "./bin/pack"; import { Args } from "./bin/index"; export interface GenerateOptions { @@ -46,6 +47,14 @@ export interface GenerateOptions { * SDK version (defaults to package version) */ version?: string; + /** + * Directory to place the tarball (pack command only) + */ + packDest?: string; + /** + * Keep the generated client directory after packing + */ + keepGenerated?: boolean; } /** @@ -63,6 +72,8 @@ function optionsToArgs(options: GenerateOptions = {}): Args { if (options.watch) args["--watch"] = true; if (options.apiVersion) args["--api-version"] = options.apiVersion; if (options.debug) args["--debug"] = true; + if (options.packDest) args["--pack-dest"] = options.packDest; + if (options.keepGenerated) args["--keep-generated"] = true; return args as Args; } @@ -141,6 +152,40 @@ export async function dev(options: GenerateOptions = {}): Promise { */ export const build = generate; +/** + * Create a standalone tarball of the BaseHub client + * + * @param options Configuration options for generation and packing + * @returns Promise that resolves with the path to the created tarball + * + * @example + * ```typescript + * import { pack } from 'basehub/cli' + * + * // Create tarball with default settings + * const tarballPath = await pack() + * console.log('Tarball created at:', tarballPath) + * + * // Create tarball with custom options + * const customPath = await pack({ + * output: './my-basehub', + * draft: true, + * packDest: './dist', // Place tarball in ./dist/ + * keepGenerated: true // Keep generated client directory + * }) + * ``` + */ +export async function pack(options: GenerateOptions = {}): Promise { + const version = options.version || getPackageVersion(); + const args = optionsToArgs(options); + const opts = { + version, + ...(options.forceDraft && { forceDraft: true }), + }; + + return packCommand(args, opts); +} + // Re-export types that might be useful export type { Args } from "./bin/index"; export type { Options } from "./bin/util/get-stuff-from-env"; diff --git a/packages/basehub/vitest.config.ts b/packages/basehub/vitest.config.ts new file mode 100644 index 00000000..8319380c --- /dev/null +++ b/packages/basehub/vitest.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + globals: true, + environment: "node", + testTimeout: 60000, // 60s timeout for pack tests (they can be slow) + hookTimeout: 60000, + }, +}); diff --git a/playground/CHANGELOG.md b/playground/CHANGELOG.md index 84adfb07..44c5e2dd 100644 --- a/playground/CHANGELOG.md +++ b/playground/CHANGELOG.md @@ -1,5 +1,110 @@ # playground +## 0.0.216-canary.16 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.16 + +## 0.0.216-canary.15 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.15 + +## 0.0.216-canary.14 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.14 + +## 0.0.216-canary.13 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.13 + +## 0.0.216-canary.12 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.12 + +## 0.0.216-canary.11 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.11 + +## 0.0.216-canary.10 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.10 + +## 0.0.216-canary.9 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.9 + +## 0.0.216-canary.8 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.8 + +## 0.0.216-canary.7 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.7 + +## 0.0.216-canary.6 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.6 + +## 0.0.216-canary.5 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.5 + +## 0.0.216-canary.4 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.4 + +## 0.0.216-canary.3 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.3 + +## 0.0.216-canary.2 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.2 + ## 0.0.216-canary.1 ### Patch Changes diff --git a/playground/package.json b/playground/package.json index 7bdfebcb..830e0a08 100644 --- a/playground/package.json +++ b/playground/package.json @@ -1,7 +1,7 @@ { "name": "playground", "private": true, - "version": "0.0.216-canary.1", + "version": "0.0.216-canary.16", "scripts": { "dev": "basehub dev & next dev --port 3003", "build": "basehub && next build", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 96b85c49..5dd75c05 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -137,6 +137,9 @@ importers: '@types/react-dom': specifier: 18.2.7 version: 18.2.7 + '@types/tar': + specifier: ^6.1.5 + version: 6.1.13 dts-bundle-generator: specifier: ^9.5.1 version: 9.5.1 @@ -155,6 +158,9 @@ importers: react-dom: specifier: 18.2.0 version: 18.2.0(react@18.2.0) + tar: + specifier: ^6.2.0 + version: 6.2.1 tsconfig: specifier: workspace:* version: link:../../internal/tsconfig @@ -164,6 +170,9 @@ importers: type-fest: specifier: 3.0.0 version: 3.0.0 + vitest: + specifier: ^0.32.3 + version: 0.32.4(sass@1.62.0) playground: dependencies: @@ -299,6 +308,12 @@ packages: cpu: [ppc64] os: [aix] + '@esbuild/android-arm64@0.18.20': + resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + '@esbuild/android-arm64@0.19.2': resolution: {integrity: sha512-lsB65vAbe90I/Qe10OjkmrdxSX4UJDjosDgb8sZUKcg3oefEuW2OT2Vozz8ef7wrJbMcmhvCC+hciF8jY/uAkw==} engines: {node: '>=12'} @@ -311,6 +326,12 @@ packages: cpu: [arm64] os: [android] + '@esbuild/android-arm@0.18.20': + resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + '@esbuild/android-arm@0.19.2': resolution: {integrity: sha512-tM8yLeYVe7pRyAu9VMi/Q7aunpLwD139EY1S99xbQkT4/q2qa6eA4ige/WJQYdJ8GBL1K33pPFhPfPdJ/WzT8Q==} engines: {node: '>=12'} @@ -323,6 +344,12 @@ packages: cpu: [arm] os: [android] + '@esbuild/android-x64@0.18.20': + resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + '@esbuild/android-x64@0.19.2': resolution: {integrity: sha512-qK/TpmHt2M/Hg82WXHRc/W/2SGo/l1thtDHZWqFq7oi24AjZ4O/CpPSu6ZuYKFkEgmZlFoa7CooAyYmuvnaG8w==} engines: {node: '>=12'} @@ -335,6 +362,12 @@ packages: cpu: [x64] os: [android] + '@esbuild/darwin-arm64@0.18.20': + resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + '@esbuild/darwin-arm64@0.19.2': resolution: {integrity: sha512-Ora8JokrvrzEPEpZO18ZYXkH4asCdc1DLdcVy8TGf5eWtPO1Ie4WroEJzwI52ZGtpODy3+m0a2yEX9l+KUn0tA==} engines: {node: '>=12'} @@ -347,6 +380,12 @@ packages: cpu: [arm64] os: [darwin] + '@esbuild/darwin-x64@0.18.20': + resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + '@esbuild/darwin-x64@0.19.2': resolution: {integrity: sha512-tP+B5UuIbbFMj2hQaUr6EALlHOIOmlLM2FK7jeFBobPy2ERdohI4Ka6ZFjZ1ZYsrHE/hZimGuU90jusRE0pwDw==} engines: {node: '>=12'} @@ -359,6 +398,12 @@ packages: cpu: [x64] os: [darwin] + '@esbuild/freebsd-arm64@0.18.20': + resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + '@esbuild/freebsd-arm64@0.19.2': resolution: {integrity: sha512-YbPY2kc0acfzL1VPVK6EnAlig4f+l8xmq36OZkU0jzBVHcOTyQDhnKQaLzZudNJQyymd9OqQezeaBgkTGdTGeQ==} engines: {node: '>=12'} @@ -371,6 +416,12 @@ packages: cpu: [arm64] os: [freebsd] + '@esbuild/freebsd-x64@0.18.20': + resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + '@esbuild/freebsd-x64@0.19.2': resolution: {integrity: sha512-nSO5uZT2clM6hosjWHAsS15hLrwCvIWx+b2e3lZ3MwbYSaXwvfO528OF+dLjas1g3bZonciivI8qKR/Hm7IWGw==} engines: {node: '>=12'} @@ -383,6 +434,12 @@ packages: cpu: [x64] os: [freebsd] + '@esbuild/linux-arm64@0.18.20': + resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + '@esbuild/linux-arm64@0.19.2': resolution: {integrity: sha512-ig2P7GeG//zWlU0AggA3pV1h5gdix0MA3wgB+NsnBXViwiGgY77fuN9Wr5uoCrs2YzaYfogXgsWZbm+HGr09xg==} engines: {node: '>=12'} @@ -395,6 +452,12 @@ packages: cpu: [arm64] os: [linux] + '@esbuild/linux-arm@0.18.20': + resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + '@esbuild/linux-arm@0.19.2': resolution: {integrity: sha512-Odalh8hICg7SOD7XCj0YLpYCEc+6mkoq63UnExDCiRA2wXEmGlK5JVrW50vZR9Qz4qkvqnHcpH+OFEggO3PgTg==} engines: {node: '>=12'} @@ -407,6 +470,12 @@ packages: cpu: [arm] os: [linux] + '@esbuild/linux-ia32@0.18.20': + resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + '@esbuild/linux-ia32@0.19.2': resolution: {integrity: sha512-mLfp0ziRPOLSTek0Gd9T5B8AtzKAkoZE70fneiiyPlSnUKKI4lp+mGEnQXcQEHLJAcIYDPSyBvsUbKUG2ri/XQ==} engines: {node: '>=12'} @@ -419,6 +488,12 @@ packages: cpu: [ia32] os: [linux] + '@esbuild/linux-loong64@0.18.20': + resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + '@esbuild/linux-loong64@0.19.2': resolution: {integrity: sha512-hn28+JNDTxxCpnYjdDYVMNTR3SKavyLlCHHkufHV91fkewpIyQchS1d8wSbmXhs1fiYDpNww8KTFlJ1dHsxeSw==} engines: {node: '>=12'} @@ -431,6 +506,12 @@ packages: cpu: [loong64] os: [linux] + '@esbuild/linux-mips64el@0.18.20': + resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + '@esbuild/linux-mips64el@0.19.2': resolution: {integrity: sha512-KbXaC0Sejt7vD2fEgPoIKb6nxkfYW9OmFUK9XQE4//PvGIxNIfPk1NmlHmMg6f25x57rpmEFrn1OotASYIAaTg==} engines: {node: '>=12'} @@ -443,6 +524,12 @@ packages: cpu: [mips64el] os: [linux] + '@esbuild/linux-ppc64@0.18.20': + resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + '@esbuild/linux-ppc64@0.19.2': resolution: {integrity: sha512-dJ0kE8KTqbiHtA3Fc/zn7lCd7pqVr4JcT0JqOnbj4LLzYnp+7h8Qi4yjfq42ZlHfhOCM42rBh0EwHYLL6LEzcw==} engines: {node: '>=12'} @@ -455,6 +542,12 @@ packages: cpu: [ppc64] os: [linux] + '@esbuild/linux-riscv64@0.18.20': + resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + '@esbuild/linux-riscv64@0.19.2': resolution: {integrity: sha512-7Z/jKNFufZ/bbu4INqqCN6DDlrmOTmdw6D0gH+6Y7auok2r02Ur661qPuXidPOJ+FSgbEeQnnAGgsVynfLuOEw==} engines: {node: '>=12'} @@ -467,6 +560,12 @@ packages: cpu: [riscv64] os: [linux] + '@esbuild/linux-s390x@0.18.20': + resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + '@esbuild/linux-s390x@0.19.2': resolution: {integrity: sha512-U+RinR6aXXABFCcAY4gSlv4CL1oOVvSSCdseQmGO66H+XyuQGZIUdhG56SZaDJQcLmrSfRmx5XZOWyCJPRqS7g==} engines: {node: '>=12'} @@ -479,6 +578,12 @@ packages: cpu: [s390x] os: [linux] + '@esbuild/linux-x64@0.18.20': + resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + '@esbuild/linux-x64@0.19.2': resolution: {integrity: sha512-oxzHTEv6VPm3XXNaHPyUTTte+3wGv7qVQtqaZCrgstI16gCuhNOtBXLEBkBREP57YTd68P0VgDgG73jSD8bwXQ==} engines: {node: '>=12'} @@ -497,6 +602,12 @@ packages: cpu: [arm64] os: [netbsd] + '@esbuild/netbsd-x64@0.18.20': + resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + '@esbuild/netbsd-x64@0.19.2': resolution: {integrity: sha512-WNa5zZk1XpTTwMDompZmvQLHszDDDN7lYjEHCUmAGB83Bgs20EMs7ICD+oKeT6xt4phV4NDdSi/8OfjPbSbZfQ==} engines: {node: '>=12'} @@ -515,6 +626,12 @@ packages: cpu: [arm64] os: [openbsd] + '@esbuild/openbsd-x64@0.18.20': + resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + '@esbuild/openbsd-x64@0.19.2': resolution: {integrity: sha512-S6kI1aT3S++Dedb7vxIuUOb3oAxqxk2Rh5rOXOTYnzN8JzW1VzBd+IqPiSpgitu45042SYD3HCoEyhLKQcDFDw==} engines: {node: '>=12'} @@ -527,6 +644,12 @@ packages: cpu: [x64] os: [openbsd] + '@esbuild/sunos-x64@0.18.20': + resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + '@esbuild/sunos-x64@0.19.2': resolution: {integrity: sha512-VXSSMsmb+Z8LbsQGcBMiM+fYObDNRm8p7tkUDMPG/g4fhFX5DEFmjxIEa3N8Zr96SjsJ1woAhF0DUnS3MF3ARw==} engines: {node: '>=12'} @@ -539,6 +662,12 @@ packages: cpu: [x64] os: [sunos] + '@esbuild/win32-arm64@0.18.20': + resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + '@esbuild/win32-arm64@0.19.2': resolution: {integrity: sha512-5NayUlSAyb5PQYFAU9x3bHdsqB88RC3aM9lKDAz4X1mo/EchMIT1Q+pSeBXNgkfNmRecLXA0O8xP+x8V+g/LKg==} engines: {node: '>=12'} @@ -551,6 +680,12 @@ packages: cpu: [arm64] os: [win32] + '@esbuild/win32-ia32@0.18.20': + resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + '@esbuild/win32-ia32@0.19.2': resolution: {integrity: sha512-47gL/ek1v36iN0wL9L4Q2MFdujR0poLZMJwhO2/N3gA89jgHp4MR8DKCmwYtGNksbfJb9JoTtbkoe6sDhg2QTA==} engines: {node: '>=12'} @@ -563,6 +698,12 @@ packages: cpu: [ia32] os: [win32] + '@esbuild/win32-x64@0.18.20': + resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + '@esbuild/win32-x64@0.19.2': resolution: {integrity: sha512-tcuhV7ncXBqbt/Ybf0IyrMcwVOAPDckMK9rXNHtF17UTK18OKLpg08glminN06pt2WCoALhXdLfSPbVvK/6fxw==} engines: {node: '>=12'} @@ -649,6 +790,10 @@ packages: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} + '@jest/schemas@29.6.3': + resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + '@jridgewell/gen-mapping@0.3.5': resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} engines: {node: '>=6.0.0'} @@ -664,6 +809,9 @@ packages: '@jridgewell/sourcemap-codec@1.4.15': resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + '@jridgewell/sourcemap-codec@1.5.0': + resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} @@ -991,6 +1139,9 @@ packages: '@shikijs/vscode-textmate@9.3.1': resolution: {integrity: sha512-79QfK1393x9Ho60QFyLti+QfdJzRQCVLFb97kOIV7Eo9vQU/roINgk7m24uv0a7AUvN//RDH36FLjjK48v0s9g==} + '@sinclair/typebox@0.27.8': + resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + '@swc/counter@0.1.3': resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} @@ -1007,6 +1158,14 @@ packages: resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} engines: {node: '>=10.13.0'} + '@types/chai-subset@1.3.6': + resolution: {integrity: sha512-m8lERkkQj+uek18hXOZuec3W/fCRTrU4hrnXjH3qhHy96ytuPaPiWGgu7sJb7tZxZonO75vYAjCvpe/e4VUwRw==} + peerDependencies: + '@types/chai': <5.2.0 + + '@types/chai@4.3.20': + resolution: {integrity: sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ==} + '@types/debug@4.1.12': resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==} @@ -1073,6 +1232,9 @@ packages: '@types/semver@7.5.8': resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} + '@types/tar@6.1.13': + resolution: {integrity: sha512-IznnlmU5f4WcGTh2ltRu/Ijpmk8wiWXfF0VA4s+HPjHZgvFggk1YaIkbo5krX/zUCzWF8N/l4+W/LNxnvAJ8nw==} + '@types/unist@2.0.11': resolution: {integrity: sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==} @@ -1140,6 +1302,21 @@ packages: '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} + '@vitest/expect@0.32.4': + resolution: {integrity: sha512-m7EPUqmGIwIeoU763N+ivkFjTzbaBn0n9evsTOcde03ugy2avPs3kZbYmw3DkcH1j5mxhMhdamJkLQ6dM1bk/A==} + + '@vitest/runner@0.32.4': + resolution: {integrity: sha512-cHOVCkiRazobgdKLnczmz2oaKK9GJOw6ZyRcaPdssO1ej+wzHVIkWiCiNacb3TTYPdzMddYkCgMjZ4r8C0JFCw==} + + '@vitest/snapshot@0.32.4': + resolution: {integrity: sha512-IRpyqn9t14uqsFlVI2d7DFMImGMs1Q9218of40bdQQgMePwVdmix33yMNnebXcTzDU5eiV3eUsoxxH5v0x/IQA==} + + '@vitest/spy@0.32.4': + resolution: {integrity: sha512-oA7rCOqVOOpE6rEoXuCOADX7Lla1LIa4hljI2MSccbpec54q+oifhziZIJXxlE/CvI2E+ElhBHzVu0VEvJGQKQ==} + + '@vitest/utils@0.32.4': + resolution: {integrity: sha512-Gwnl8dhd1uJ+HXrYyV0eRqfmk9ek1ASE/LWfTCuWMw+d07ogHqp4hEAV28NiecimK6UY9DpSEPh+pXBA5gtTBg==} + '@xmldom/xmldom@0.9.6': resolution: {integrity: sha512-Su4xcxR0CPGwlDHNmVP09fqET9YxbyDXHaSob6JlBH7L6reTYaeim6zbk9o08UarO0L5GTRo3uzl0D+9lSxmvw==} engines: {node: '>=14.6'} @@ -1190,6 +1367,10 @@ packages: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} + ansi-styles@5.2.0: + resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} + engines: {node: '>=10'} + ansi-styles@6.2.1: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} @@ -1248,6 +1429,9 @@ packages: resolution: {integrity: sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==} engines: {node: '>=0.10.0'} + assertion-error@1.1.0: + resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + ast-types-flow@0.0.8: resolution: {integrity: sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==} @@ -1354,6 +1538,10 @@ packages: ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} + chai@4.5.0: + resolution: {integrity: sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==} + engines: {node: '>=4'} + chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} engines: {node: '>=4'} @@ -1381,6 +1569,9 @@ packages: chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} + check-error@1.0.3: + resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} + chokidar@3.6.0: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} @@ -1388,6 +1579,10 @@ packages: chownr@1.1.4: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} + chownr@2.0.0: + resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} + engines: {node: '>=10'} + ci-info@3.9.0: resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} engines: {node: '>=8'} @@ -1592,6 +1787,10 @@ packages: resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==} engines: {node: '>=10'} + deep-eql@4.1.4: + resolution: {integrity: sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==} + engines: {node: '>=6'} + deep-extend@0.6.0: resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==} engines: {node: '>=4.0.0'} @@ -1632,6 +1831,10 @@ packages: devlop@1.1.0: resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} + diff-sequences@29.6.3: + resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -1751,6 +1954,11 @@ packages: peerDependencies: cssnano: ~5.0.6 + esbuild@0.18.20: + resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} + engines: {node: '>=12'} + hasBin: true + esbuild@0.19.2: resolution: {integrity: sha512-G6hPax8UbFakEj3hWO0Vs52LQ8k3lnBhxZWomUJDxfz3rZTLqF5k/FCzuNdLx2RbpBiQQF9H9onlDDH1lZsnjg==} engines: {node: '>=12'} @@ -2008,6 +2216,10 @@ packages: resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} engines: {node: '>=6 <7 || >=8'} + fs-minipass@2.1.0: + resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} + engines: {node: '>= 8'} + fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} @@ -2033,6 +2245,9 @@ packages: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} + get-func-name@2.0.2: + resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} + get-intrinsic@1.2.4: resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} engines: {node: '>= 0.4'} @@ -2480,6 +2695,10 @@ packages: resolution: {integrity: sha512-ZvFw1KWS3GVyYBYb7qkmRM/WwL2TQQBxgCK62rlvm4WpVQ23Nb4tYjApUlfjrEGvOs7KHEsmyUn75OHZrJMWPw==} engines: {node: '>= 12.13.0'} + local-pkg@0.4.3: + resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==} + engines: {node: '>=14'} + locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} @@ -2531,6 +2750,9 @@ packages: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true + loupe@2.3.7: + resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} + lru-cache@10.2.2: resolution: {integrity: sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==} engines: {node: 14 || >=16.14} @@ -2538,6 +2760,9 @@ packages: lru-cache@4.1.5: resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} + magic-string@0.30.17: + resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==} + map-obj@1.0.1: resolution: {integrity: sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==} engines: {node: '>=0.10.0'} @@ -2685,10 +2910,26 @@ packages: minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + minipass@3.3.6: + resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==} + engines: {node: '>=8'} + + minipass@4.2.8: + resolution: {integrity: sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==} + engines: {node: '>=8'} + + minipass@5.0.0: + resolution: {integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==} + engines: {node: '>=8'} + minipass@7.1.2: resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} engines: {node: '>=16 || 14 >=14.17'} + minizlib@2.1.2: + resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} + engines: {node: '>= 8'} + mixme@0.5.10: resolution: {integrity: sha512-5H76ANWinB1H3twpJ6JY8uvAtpmFvHNArpilJAjXRKXSDDLPIMoZArw5SH0q9z+lLs8IrMw7Q2VWpWimFKFT1Q==} engines: {node: '>= 8.0.0'} @@ -2700,6 +2941,11 @@ packages: resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} hasBin: true + mkdirp@1.0.4: + resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} + engines: {node: '>=10'} + hasBin: true + mlly@1.7.3: resolution: {integrity: sha512-xUsx5n/mN0uQf4V548PKQ+YShA4/IW0KI1dZhrNrPCLG+xizETbHTkOa1f8/xut9JRPp8kQuMnz0oqwkTiLo/A==} @@ -2869,6 +3115,10 @@ packages: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} + p-limit@4.0.0: + resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + p-locate@4.1.0: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} engines: {node: '>=8'} @@ -2925,6 +3175,9 @@ packages: pathe@1.1.2: resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} + pathval@1.1.1: + resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} @@ -3204,6 +3457,10 @@ packages: engines: {node: '>=14'} hasBin: true + pretty-format@29.7.0: + resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + prop-types@15.8.1: resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} @@ -3261,6 +3518,9 @@ packages: react-is@16.13.1: resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} + react-is@18.3.1: + resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} + react-tweet@3.1.1: resolution: {integrity: sha512-8GQLa5y0G56kvGQkN7OiaKkjFAhWYVdyFq62ioY2qVtpMrjchVU+3KnqneCyp0+BemOQZkg6WWp/qoCNeEMH6A==} peerDependencies: @@ -3363,6 +3623,11 @@ packages: deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true + rollup@3.29.5: + resolution: {integrity: sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==} + engines: {node: '>=14.18.0', npm: '>=8.0.0'} + hasBin: true + rollup@4.18.0: resolution: {integrity: sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} @@ -3447,6 +3712,9 @@ packages: resolution: {integrity: sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==} engines: {node: '>= 0.4'} + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} @@ -3521,6 +3789,12 @@ packages: resolution: {integrity: sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==} deprecated: 'Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility' + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + std-env@3.9.0: + resolution: {integrity: sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==} + stream-transform@2.1.3: resolution: {integrity: sha512-9GHUiM5hMiCi6Y03jD2ARC1ettBXkQBoQAe7nJsPknnI0ow10aXjTnew8QtYQmLjzn974BnmWEAJgCY6ZP1DeQ==} @@ -3592,6 +3866,9 @@ packages: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} + strip-literal@1.3.0: + resolution: {integrity: sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==} + style-to-object@1.0.6: resolution: {integrity: sha512-khxq+Qm3xEyZfKd/y9L3oIWQimxuc4STrQKtQn8aSDRHb8mFgpukgX1hdzfrMEW6JCjyJ8p89x+IUMVnCBI1PA==} @@ -3652,6 +3929,10 @@ packages: resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==} engines: {node: '>=6'} + tar@6.2.1: + resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} + engines: {node: '>=10'} + term-size@2.2.1: resolution: {integrity: sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==} engines: {node: '>=8'} @@ -3666,10 +3947,21 @@ packages: thenify@3.3.1: resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + tinyglobby@0.2.10: resolution: {integrity: sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==} engines: {node: '>=12.0.0'} + tinypool@0.5.0: + resolution: {integrity: sha512-paHQtnrlS1QZYKF/GnLoOM/DN9fqaGOFbCbxzAhwniySnzl9Ebk8w73/dd34DAhe/obUbPAOldTyYXQZxnPBPQ==} + engines: {node: '>=14.0.0'} + + tinyspy@2.2.1: + resolution: {integrity: sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==} + engines: {node: '>=14.0.0'} + tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} @@ -3926,6 +4218,70 @@ packages: vfile@6.0.3: resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==} + vite-node@0.32.4: + resolution: {integrity: sha512-L2gIw+dCxO0LK14QnUMoqSYpa9XRGnTTTDjW2h19Mr+GR0EFj4vx52W41gFXfMLqpA00eK4ZjOVYo1Xk//LFEw==} + engines: {node: '>=v14.18.0'} + hasBin: true + + vite@4.5.14: + resolution: {integrity: sha512-+v57oAaoYNnO3hIu5Z/tJRZjq5aHM2zDve9YZ8HngVHbhk66RStobhb1sqPMIPEleV6cNKYK4eGrAbE9Ulbl2g==} + engines: {node: ^14.18.0 || >=16.0.0} + hasBin: true + peerDependencies: + '@types/node': '>= 14' + less: '*' + lightningcss: ^1.21.0 + sass: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + + vitest@0.32.4: + resolution: {integrity: sha512-3czFm8RnrsWwIzVDu/Ca48Y/M+qh3vOnF16czJm98Q/AN1y3B6PBsyV8Re91Ty5s7txKNjEhpgtGPcfdbh2MZg==} + engines: {node: '>=v14.18.0'} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@vitest/browser': '*' + '@vitest/ui': '*' + happy-dom: '*' + jsdom: '*' + playwright: '*' + safaridriver: '*' + webdriverio: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + playwright: + optional: true + safaridriver: + optional: true + webdriverio: + optional: true + watchpack@2.4.0: resolution: {integrity: sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==} engines: {node: '>=10.13.0'} @@ -3975,6 +4331,11 @@ packages: engines: {node: '>= 8'} hasBin: true + why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + word-wrap@1.2.5: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} @@ -4016,6 +4377,9 @@ packages: yallist@2.1.2: resolution: {integrity: sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==} + yallist@4.0.0: + resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + yaml@1.10.2: resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} engines: {node: '>= 6'} @@ -4045,6 +4409,10 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} + yocto-queue@1.2.1: + resolution: {integrity: sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg==} + engines: {node: '>=12.20'} + zod-package-json@1.0.3: resolution: {integrity: sha512-Mb6GzuRyUEl8X+6V6xzHbd4XV0au/4gOYrYP+CAfHL32uPmGswES+v2YqonZiW1NZWVA3jkssCKSU2knonm/aQ==} engines: {node: '>=20'} @@ -4259,96 +4627,144 @@ snapshots: '@esbuild/aix-ppc64@0.25.5': optional: true + '@esbuild/android-arm64@0.18.20': + optional: true + '@esbuild/android-arm64@0.19.2': optional: true '@esbuild/android-arm64@0.25.5': optional: true + '@esbuild/android-arm@0.18.20': + optional: true + '@esbuild/android-arm@0.19.2': optional: true '@esbuild/android-arm@0.25.5': optional: true + '@esbuild/android-x64@0.18.20': + optional: true + '@esbuild/android-x64@0.19.2': optional: true '@esbuild/android-x64@0.25.5': optional: true + '@esbuild/darwin-arm64@0.18.20': + optional: true + '@esbuild/darwin-arm64@0.19.2': optional: true '@esbuild/darwin-arm64@0.25.5': optional: true + '@esbuild/darwin-x64@0.18.20': + optional: true + '@esbuild/darwin-x64@0.19.2': optional: true '@esbuild/darwin-x64@0.25.5': optional: true + '@esbuild/freebsd-arm64@0.18.20': + optional: true + '@esbuild/freebsd-arm64@0.19.2': optional: true '@esbuild/freebsd-arm64@0.25.5': optional: true + '@esbuild/freebsd-x64@0.18.20': + optional: true + '@esbuild/freebsd-x64@0.19.2': optional: true '@esbuild/freebsd-x64@0.25.5': optional: true + '@esbuild/linux-arm64@0.18.20': + optional: true + '@esbuild/linux-arm64@0.19.2': optional: true '@esbuild/linux-arm64@0.25.5': optional: true + '@esbuild/linux-arm@0.18.20': + optional: true + '@esbuild/linux-arm@0.19.2': optional: true '@esbuild/linux-arm@0.25.5': optional: true + '@esbuild/linux-ia32@0.18.20': + optional: true + '@esbuild/linux-ia32@0.19.2': optional: true '@esbuild/linux-ia32@0.25.5': optional: true + '@esbuild/linux-loong64@0.18.20': + optional: true + '@esbuild/linux-loong64@0.19.2': optional: true '@esbuild/linux-loong64@0.25.5': optional: true + '@esbuild/linux-mips64el@0.18.20': + optional: true + '@esbuild/linux-mips64el@0.19.2': optional: true '@esbuild/linux-mips64el@0.25.5': optional: true + '@esbuild/linux-ppc64@0.18.20': + optional: true + '@esbuild/linux-ppc64@0.19.2': optional: true '@esbuild/linux-ppc64@0.25.5': optional: true + '@esbuild/linux-riscv64@0.18.20': + optional: true + '@esbuild/linux-riscv64@0.19.2': optional: true '@esbuild/linux-riscv64@0.25.5': optional: true + '@esbuild/linux-s390x@0.18.20': + optional: true + '@esbuild/linux-s390x@0.19.2': optional: true '@esbuild/linux-s390x@0.25.5': optional: true + '@esbuild/linux-x64@0.18.20': + optional: true + '@esbuild/linux-x64@0.19.2': optional: true @@ -4358,6 +4774,9 @@ snapshots: '@esbuild/netbsd-arm64@0.25.5': optional: true + '@esbuild/netbsd-x64@0.18.20': + optional: true + '@esbuild/netbsd-x64@0.19.2': optional: true @@ -4367,30 +4786,45 @@ snapshots: '@esbuild/openbsd-arm64@0.25.5': optional: true + '@esbuild/openbsd-x64@0.18.20': + optional: true + '@esbuild/openbsd-x64@0.19.2': optional: true '@esbuild/openbsd-x64@0.25.5': optional: true + '@esbuild/sunos-x64@0.18.20': + optional: true + '@esbuild/sunos-x64@0.19.2': optional: true '@esbuild/sunos-x64@0.25.5': optional: true + '@esbuild/win32-arm64@0.18.20': + optional: true + '@esbuild/win32-arm64@0.19.2': optional: true '@esbuild/win32-arm64@0.25.5': optional: true + '@esbuild/win32-ia32@0.18.20': + optional: true + '@esbuild/win32-ia32@0.19.2': optional: true '@esbuild/win32-ia32@0.25.5': optional: true + '@esbuild/win32-x64@0.18.20': + optional: true + '@esbuild/win32-x64@0.19.2': optional: true @@ -4491,6 +4925,10 @@ snapshots: wrap-ansi: 8.1.0 wrap-ansi-cjs: wrap-ansi@7.0.0 + '@jest/schemas@29.6.3': + dependencies: + '@sinclair/typebox': 0.27.8 + '@jridgewell/gen-mapping@0.3.5': dependencies: '@jridgewell/set-array': 1.2.1 @@ -4503,6 +4941,8 @@ snapshots: '@jridgewell/sourcemap-codec@1.4.15': {} + '@jridgewell/sourcemap-codec@1.5.0': {} + '@jridgewell/trace-mapping@0.3.25': dependencies: '@jridgewell/resolve-uri': 3.1.2 @@ -4783,6 +5223,8 @@ snapshots: '@shikijs/vscode-textmate@9.3.1': {} + '@sinclair/typebox@0.27.8': {} + '@swc/counter@0.1.3': {} '@swc/helpers@0.5.11': @@ -4800,6 +5242,12 @@ snapshots: '@trysound/sax@0.2.0': {} + '@types/chai-subset@1.3.6(@types/chai@4.3.20)': + dependencies: + '@types/chai': 4.3.20 + + '@types/chai@4.3.20': {} + '@types/debug@4.1.12': dependencies: '@types/ms': 0.7.34 @@ -4864,6 +5312,11 @@ snapshots: '@types/semver@7.5.8': {} + '@types/tar@6.1.13': + dependencies: + '@types/node': 18.13.0 + minipass: 4.2.8 + '@types/unist@2.0.11': {} '@types/unist@3.0.3': {} @@ -4955,6 +5408,34 @@ snapshots: '@ungap/structured-clone@1.2.0': {} + '@vitest/expect@0.32.4': + dependencies: + '@vitest/spy': 0.32.4 + '@vitest/utils': 0.32.4 + chai: 4.5.0 + + '@vitest/runner@0.32.4': + dependencies: + '@vitest/utils': 0.32.4 + p-limit: 4.0.0 + pathe: 1.1.2 + + '@vitest/snapshot@0.32.4': + dependencies: + magic-string: 0.30.17 + pathe: 1.1.2 + pretty-format: 29.7.0 + + '@vitest/spy@0.32.4': + dependencies: + tinyspy: 2.2.1 + + '@vitest/utils@0.32.4': + dependencies: + diff-sequences: 29.6.3 + loupe: 2.3.7 + pretty-format: 29.7.0 + '@xmldom/xmldom@0.9.6': {} acorn-jsx@5.3.2(acorn@8.11.3): @@ -4992,6 +5473,8 @@ snapshots: dependencies: color-convert: 2.0.1 + ansi-styles@5.2.0: {} + ansi-styles@6.2.1: {} any-promise@1.3.0: {} @@ -5073,6 +5556,8 @@ snapshots: arrify@1.0.1: {} + assertion-error@1.1.0: {} + ast-types-flow@0.0.8: {} asynckit@0.4.0: {} @@ -5186,6 +5671,16 @@ snapshots: ccount@2.0.1: {} + chai@4.5.0: + dependencies: + assertion-error: 1.1.0 + check-error: 1.0.3 + deep-eql: 4.1.4 + get-func-name: 2.0.2 + loupe: 2.3.7 + pathval: 1.1.1 + type-detect: 4.1.0 + chalk@2.4.2: dependencies: ansi-styles: 3.2.1 @@ -5212,6 +5707,10 @@ snapshots: chardet@0.7.0: {} + check-error@1.0.3: + dependencies: + get-func-name: 2.0.2 + chokidar@3.6.0: dependencies: anymatch: 3.1.3 @@ -5226,6 +5725,8 @@ snapshots: chownr@1.1.4: {} + chownr@2.0.0: {} + ci-info@3.9.0: {} cli-cursor@4.0.0: @@ -5444,6 +5945,10 @@ snapshots: dependencies: mimic-response: 3.1.0 + deep-eql@4.1.4: + dependencies: + type-detect: 4.1.0 + deep-extend@0.6.0: {} deep-is@0.1.4: {} @@ -5478,6 +5983,8 @@ snapshots: dependencies: dequal: 2.0.3 + diff-sequences@29.6.3: {} + dir-glob@3.0.1: dependencies: path-type: 4.0.0 @@ -5661,6 +6168,31 @@ snapshots: postcss-modules: 4.3.1(postcss@8.4.38) sass: 1.62.0 + esbuild@0.18.20: + optionalDependencies: + '@esbuild/android-arm': 0.18.20 + '@esbuild/android-arm64': 0.18.20 + '@esbuild/android-x64': 0.18.20 + '@esbuild/darwin-arm64': 0.18.20 + '@esbuild/darwin-x64': 0.18.20 + '@esbuild/freebsd-arm64': 0.18.20 + '@esbuild/freebsd-x64': 0.18.20 + '@esbuild/linux-arm': 0.18.20 + '@esbuild/linux-arm64': 0.18.20 + '@esbuild/linux-ia32': 0.18.20 + '@esbuild/linux-loong64': 0.18.20 + '@esbuild/linux-mips64el': 0.18.20 + '@esbuild/linux-ppc64': 0.18.20 + '@esbuild/linux-riscv64': 0.18.20 + '@esbuild/linux-s390x': 0.18.20 + '@esbuild/linux-x64': 0.18.20 + '@esbuild/netbsd-x64': 0.18.20 + '@esbuild/openbsd-x64': 0.18.20 + '@esbuild/sunos-x64': 0.18.20 + '@esbuild/win32-arm64': 0.18.20 + '@esbuild/win32-ia32': 0.18.20 + '@esbuild/win32-x64': 0.18.20 + esbuild@0.19.2: optionalDependencies: '@esbuild/android-arm': 0.19.2 @@ -6049,6 +6581,10 @@ snapshots: jsonfile: 4.0.0 universalify: 0.1.2 + fs-minipass@2.1.0: + dependencies: + minipass: 3.3.6 + fs.realpath@1.0.0: {} fsevents@2.3.3: @@ -6071,6 +6607,8 @@ snapshots: get-caller-file@2.0.5: {} + get-func-name@2.0.2: {} + get-intrinsic@1.2.4: dependencies: es-errors: 1.3.0 @@ -6515,6 +7053,8 @@ snapshots: loader-utils@3.2.1: {} + local-pkg@0.4.3: {} + locate-path@5.0.0: dependencies: p-locate: 4.1.0 @@ -6557,6 +7097,10 @@ snapshots: dependencies: js-tokens: 4.0.0 + loupe@2.3.7: + dependencies: + get-func-name: 2.0.2 + lru-cache@10.2.2: {} lru-cache@4.1.5: @@ -6564,6 +7108,10 @@ snapshots: pseudomap: 1.0.2 yallist: 2.1.2 + magic-string@0.30.17: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.0 + map-obj@1.0.1: {} map-obj@4.3.0: {} @@ -6843,8 +7391,21 @@ snapshots: minimist@1.2.8: {} + minipass@3.3.6: + dependencies: + yallist: 4.0.0 + + minipass@4.2.8: {} + + minipass@5.0.0: {} + minipass@7.1.2: {} + minizlib@2.1.2: + dependencies: + minipass: 3.3.6 + yallist: 4.0.0 + mixme@0.5.10: {} mkdirp-classic@0.5.3: {} @@ -6853,6 +7414,8 @@ snapshots: dependencies: minimist: 1.2.8 + mkdirp@1.0.4: {} + mlly@1.7.3: dependencies: acorn: 8.14.0 @@ -7048,6 +7611,10 @@ snapshots: dependencies: yocto-queue: 0.1.0 + p-limit@4.0.0: + dependencies: + yocto-queue: 1.2.1 + p-locate@4.1.0: dependencies: p-limit: 2.3.0 @@ -7101,6 +7668,8 @@ snapshots: pathe@1.1.2: {} + pathval@1.1.1: {} + picocolors@1.0.1: {} picomatch@2.3.1: {} @@ -7371,6 +7940,12 @@ snapshots: prettier@3.0.3: {} + pretty-format@29.7.0: + dependencies: + '@jest/schemas': 29.6.3 + ansi-styles: 5.2.0 + react-is: 18.3.1 + prop-types@15.8.1: dependencies: loose-envify: 1.4.0 @@ -7434,6 +8009,8 @@ snapshots: react-is@16.13.1: {} + react-is@18.3.1: {} + react-tweet@3.1.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: '@swc/helpers': 0.5.11 @@ -7548,6 +8125,10 @@ snapshots: dependencies: glob: 7.2.3 + rollup@3.29.5: + optionalDependencies: + fsevents: 2.3.3 + rollup@4.18.0: dependencies: '@types/estree': 1.0.5 @@ -7666,6 +8247,8 @@ snapshots: get-intrinsic: 1.2.4 object-inspect: 1.13.1 + siginfo@2.0.0: {} + signal-exit@3.0.7: {} signal-exit@4.1.0: {} @@ -7738,6 +8321,10 @@ snapshots: stable@0.1.8: {} + stackback@0.0.2: {} + + std-env@3.9.0: {} + stream-transform@2.1.3: dependencies: mixme: 0.5.10 @@ -7823,6 +8410,10 @@ snapshots: strip-json-comments@3.1.1: {} + strip-literal@1.3.0: + dependencies: + acorn: 8.14.0 + style-to-object@1.0.6: dependencies: inline-style-parser: 0.2.3 @@ -7891,6 +8482,15 @@ snapshots: inherits: 2.0.4 readable-stream: 3.6.2 + tar@6.2.1: + dependencies: + chownr: 2.0.0 + fs-minipass: 2.1.0 + minipass: 5.0.0 + minizlib: 2.1.2 + mkdirp: 1.0.4 + yallist: 4.0.0 + term-size@2.2.1: {} text-table@0.2.0: {} @@ -7903,11 +8503,17 @@ snapshots: dependencies: any-promise: 1.3.0 + tinybench@2.9.0: {} + tinyglobby@0.2.10: dependencies: fdir: 6.4.2(picomatch@4.0.2) picomatch: 4.0.2 + tinypool@0.5.0: {} + + tinyspy@2.2.1: {} + tmp@0.0.33: dependencies: os-tmpdir: 1.0.2 @@ -8162,6 +8768,69 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 + vite-node@0.32.4(@types/node@18.13.0)(sass@1.62.0): + dependencies: + cac: 6.7.14 + debug: 4.3.4 + mlly: 1.7.3 + pathe: 1.1.2 + picocolors: 1.0.1 + vite: 4.5.14(@types/node@18.13.0)(sass@1.62.0) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + + vite@4.5.14(@types/node@18.13.0)(sass@1.62.0): + dependencies: + esbuild: 0.18.20 + postcss: 8.4.38 + rollup: 3.29.5 + optionalDependencies: + '@types/node': 18.13.0 + fsevents: 2.3.3 + sass: 1.62.0 + + vitest@0.32.4(sass@1.62.0): + dependencies: + '@types/chai': 4.3.20 + '@types/chai-subset': 1.3.6(@types/chai@4.3.20) + '@types/node': 18.13.0 + '@vitest/expect': 0.32.4 + '@vitest/runner': 0.32.4 + '@vitest/snapshot': 0.32.4 + '@vitest/spy': 0.32.4 + '@vitest/utils': 0.32.4 + acorn: 8.14.0 + acorn-walk: 8.3.2 + cac: 6.7.14 + chai: 4.5.0 + debug: 4.3.4 + local-pkg: 0.4.3 + magic-string: 0.30.17 + pathe: 1.1.2 + picocolors: 1.0.1 + std-env: 3.9.0 + strip-literal: 1.3.0 + tinybench: 2.9.0 + tinypool: 0.5.0 + vite: 4.5.14(@types/node@18.13.0)(sass@1.62.0) + vite-node: 0.32.4(@types/node@18.13.0)(sass@1.62.0) + why-is-node-running: 2.3.0 + transitivePeerDependencies: + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + watchpack@2.4.0: dependencies: glob-to-regexp: 0.4.1 @@ -8247,6 +8916,11 @@ snapshots: dependencies: isexe: 2.0.0 + why-is-node-running@2.3.0: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + word-wrap@1.2.5: {} wrap-ansi@6.2.0: @@ -8277,6 +8951,8 @@ snapshots: yallist@2.1.2: {} + yallist@4.0.0: {} + yaml@1.10.2: {} yaml@2.4.2: {} @@ -8314,6 +8990,8 @@ snapshots: yocto-queue@0.1.0: {} + yocto-queue@1.2.1: {} + zod-package-json@1.0.3: dependencies: zod: 3.23.8 From 2b3fee0f4063a86a8efd58b41d98ed59294775c2 Mon Sep 17 00:00:00 2001 From: Julian Benegas Date: Wed, 11 Jun 2025 12:35:29 -0300 Subject: [PATCH 4/4] upd --- .changeset/kind-ways-destroy.md | 5 ++ .changeset/pre.json | 1 + packages/basehub/CHANGELOG.md | 6 +++ packages/basehub/package.json | 2 +- packages/basehub/src/bin/pack.ts | 11 +--- packages/basehub/src/bin/shared-modules.ts | 58 ++++++++++++++++++++++ playground/CHANGELOG.md | 7 +++ playground/package.json | 2 +- 8 files changed, 81 insertions(+), 11 deletions(-) create mode 100644 .changeset/kind-ways-destroy.md diff --git a/.changeset/kind-ways-destroy.md b/.changeset/kind-ways-destroy.md new file mode 100644 index 00000000..70e7bbfd --- /dev/null +++ b/.changeset/kind-ways-destroy.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +asd diff --git a/.changeset/pre.json b/.changeset/pre.json index 13eb59d4..4545d97f 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -15,6 +15,7 @@ "dull-pans-argue", "happy-wombats-sparkle", "honest-terms-nail", + "kind-ways-destroy", "lemon-pumpkins-report", "mighty-gifts-cross", "odd-spoons-joke", diff --git a/packages/basehub/CHANGELOG.md b/packages/basehub/CHANGELOG.md index 288ed0b6..6f9067ab 100644 --- a/packages/basehub/CHANGELOG.md +++ b/packages/basehub/CHANGELOG.md @@ -1,5 +1,11 @@ # basehub +## 8.3.0-canary.17 + +### Patch Changes + +- asd + ## 8.3.0-canary.16 ### Patch Changes diff --git a/packages/basehub/package.json b/packages/basehub/package.json index 2da19a74..f1d7ace2 100644 --- a/packages/basehub/package.json +++ b/packages/basehub/package.json @@ -2,7 +2,7 @@ "name": "basehub", "description": "A very fast Headless CMS.", "author": "JB ", - "version": "8.3.0-canary.16", + "version": "8.3.0-canary.17", "license": "MIT", "repository": "basehub-ai/basehub", "bugs": "https://github.com/basehub-ai/basehub/issues", diff --git a/packages/basehub/src/bin/pack.ts b/packages/basehub/src/bin/pack.ts index 50899b2d..8039cb75 100644 --- a/packages/basehub/src/bin/pack.ts +++ b/packages/basehub/src/bin/pack.ts @@ -1,6 +1,6 @@ import { main } from "./main"; import { Args } from "./index"; -import { ALL_PACK_MODULES } from "./shared-modules"; +import { ALL_PACK_MODULES, generatePackageExports } from "./shared-modules"; import fs from "fs"; import path from "path"; import { exec } from "child_process"; @@ -170,14 +170,7 @@ async function bundleStandalone( name: "basehub", main: "./index.js", types: "./index.d.ts", - exports: { - ".": { - import: "./index.js", - require: "./index.js", - types: "./index.d.ts", - }, - "./*": "./*", - }, + exports: generatePackageExports(true), // Include pack-only modules for standalone sideEffects: false, files: ["**/*"], dependencies: basehubDependencies, diff --git a/packages/basehub/src/bin/shared-modules.ts b/packages/basehub/src/bin/shared-modules.ts index 2f74d1fc..c8407cf7 100644 --- a/packages/basehub/src/bin/shared-modules.ts +++ b/packages/basehub/src/bin/shared-modules.ts @@ -27,3 +27,61 @@ export const ALL_PACK_MODULES = [ ...BASEHUB_MODULES, ...PACK_ONLY_MODULES, ] as const; + +/** + * Core modules that are always exported + */ +export const CORE_MODULES = ["cli", "react-pump", "next-toolbar"] as const; + +/** + * Generate package.json exports field from module lists + */ +export function generatePackageExports(includePackOnlyModules = false) { + const exports: Record = { + ".": { + types: "./index.d.ts", + default: "./index.js", + }, + }; + + // Add core modules + for (const moduleName of CORE_MODULES) { + exports[`./${moduleName}`] = { + types: `./${moduleName}.d.ts`, + default: `./${moduleName}.js`, + }; + } + + // Add base modules + for (const moduleName of BASEHUB_MODULES) { + if (moduleName === "react-code-block/index") { + // Special case for react-code-block - export both the base and the index + exports["./react-code-block"] = { + types: "./react-code-block/index.d.ts", + default: "./react-code-block/index.js", + }; + } else if (moduleName === "react-code-block/client") { + exports["./react-code-block/client"] = { + types: "./react-code-block/client.d.ts", + default: "./react-code-block/client.js", + }; + } else { + exports[`./${moduleName}`] = { + types: `./${moduleName}.d.ts`, + default: `./${moduleName}.js`, + }; + } + } + + // Add pack-only modules if requested + if (includePackOnlyModules) { + for (const moduleName of PACK_ONLY_MODULES) { + exports[`./${moduleName}`] = { + types: `./${moduleName}.d.ts`, + default: `./${moduleName}.js`, + }; + } + } + + return exports; +} diff --git a/playground/CHANGELOG.md b/playground/CHANGELOG.md index 44c5e2dd..caddad45 100644 --- a/playground/CHANGELOG.md +++ b/playground/CHANGELOG.md @@ -1,5 +1,12 @@ # playground +## 0.0.216-canary.17 + +### Patch Changes + +- Updated dependencies + - basehub@8.3.0-canary.17 + ## 0.0.216-canary.16 ### Patch Changes diff --git a/playground/package.json b/playground/package.json index 830e0a08..c3bd395c 100644 --- a/playground/package.json +++ b/playground/package.json @@ -1,7 +1,7 @@ { "name": "playground", "private": true, - "version": "0.0.216-canary.16", + "version": "0.0.216-canary.17", "scripts": { "dev": "basehub dev & next dev --port 3003", "build": "basehub && next build",