@highstate/cli 0.27.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,8 @@ import {
12
12
  PackageRemoveCommand,
13
13
  PackageUpdateReferencesCommand,
14
14
  UpdateCommand
15
- } from "../chunk-2s546hay.js";
15
+ } from "../chunk-pa6gpwe5.js";
16
+ import"../chunk-hjrkeh0y.js";
16
17
  import"../chunk-vcev74he.js";
17
18
  export {
18
19
  UpdateCommand,
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "sourceHashes": {
3
- "./dist/commands/index.js": 3807940790,
4
- "./dist/main.js": 4186384902
3
+ "./dist/shared/index.js": 1332764379,
4
+ "./dist/commands/index.js": 422581658,
5
+ "./dist/main.js": 2703177589
5
6
  }
6
7
  }
package/dist/main.js CHANGED
@@ -13,14 +13,19 @@ import {
13
13
  PackageRemoveCommand,
14
14
  PackageUpdateReferencesCommand,
15
15
  UpdateCommand
16
- } from "./chunk-2s546hay.js";
16
+ } from "./chunk-pa6gpwe5.js";
17
+ import {
18
+ readCurrentPackageVersion
19
+ } from "./chunk-hjrkeh0y.js";
17
20
  import"./chunk-vcev74he.js";
18
21
 
19
22
  // src/main.ts
20
23
  import { Builtins, Cli } from "clipanion";
24
+ var version = await readCurrentPackageVersion(import.meta.url);
21
25
  var cli = new Cli({
22
26
  binaryName: "highstate",
23
- binaryLabel: "Highstate"
27
+ binaryLabel: "Highstate",
28
+ binaryVersion: version
24
29
  });
25
30
  cli.register(BuildCommand);
26
31
  cli.register(DesignerCommand);
@@ -0,0 +1,72 @@
1
+ // @bun
2
+ import {
3
+ PLATFORM_PACKAGES,
4
+ PULUMI_PACKAGES,
5
+ STDLIB_PACKAGES,
6
+ SourceHashCalculator,
7
+ applyOverrides,
8
+ applySchemaTransformations,
9
+ buildOverrides,
10
+ createBinTransformerPlugin,
11
+ createPackage,
12
+ disposeServices,
13
+ extractEntryPoints,
14
+ fetchLatestVersion,
15
+ fetchManifest,
16
+ fetchNpmPackument,
17
+ findWorkspaceRoot,
18
+ generateFromTemplate,
19
+ getBackendServices,
20
+ getDependencyRange,
21
+ getProjectOverrideVersion,
22
+ getProjectPlatformVersion,
23
+ getProjectPulumiSdkVersion,
24
+ getPulumiCliVersion,
25
+ highstateConfigSchema,
26
+ highstateManifestSchema,
27
+ logger,
28
+ parseFileDependencies,
29
+ readCurrentPackageVersion,
30
+ resolveVersionBundle,
31
+ scanWorkspacePackages,
32
+ schemaTransformerPlugin,
33
+ sourceHashConfigSchema,
34
+ updateTsconfigReferences,
35
+ writeJsonFile
36
+ } from "../chunk-hjrkeh0y.js";
37
+ import"../chunk-vcev74he.js";
38
+ export {
39
+ writeJsonFile,
40
+ updateTsconfigReferences,
41
+ sourceHashConfigSchema,
42
+ schemaTransformerPlugin,
43
+ scanWorkspacePackages,
44
+ resolveVersionBundle,
45
+ readCurrentPackageVersion,
46
+ parseFileDependencies,
47
+ logger,
48
+ highstateManifestSchema,
49
+ highstateConfigSchema,
50
+ getPulumiCliVersion,
51
+ getProjectPulumiSdkVersion,
52
+ getProjectPlatformVersion,
53
+ getProjectOverrideVersion,
54
+ getDependencyRange,
55
+ getBackendServices,
56
+ generateFromTemplate,
57
+ findWorkspaceRoot,
58
+ fetchNpmPackument,
59
+ fetchManifest,
60
+ fetchLatestVersion,
61
+ extractEntryPoints,
62
+ disposeServices,
63
+ createPackage,
64
+ createBinTransformerPlugin,
65
+ buildOverrides,
66
+ applySchemaTransformations,
67
+ applyOverrides,
68
+ SourceHashCalculator,
69
+ STDLIB_PACKAGES,
70
+ PULUMI_PACKAGES,
71
+ PLATFORM_PACKAGES
72
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/cli",
3
- "version": "0.27.0",
3
+ "version": "0.29.0",
4
4
  "description": "The CLI for the Highstate project.",
5
5
  "type": "module",
6
6
  "files": [
@@ -9,6 +9,10 @@
9
9
  "src"
10
10
  ],
11
11
  "exports": {
12
+ "./shared": {
13
+ "types": "./src/shared/index.ts",
14
+ "default": "./dist/shared/index.js"
15
+ },
12
16
  "./commands": {
13
17
  "types": "./src/commands/index.ts",
14
18
  "default": "./dist/commands/index.js"
@@ -34,8 +38,8 @@
34
38
  },
35
39
  "dependencies": {
36
40
  "@aws-crypto/crc32": "^5.2.0",
37
- "@highstate/backend": "0.26.0",
38
- "@highstate/contract": "0.26.0",
41
+ "@highstate/backend": "0.27.0",
42
+ "@highstate/contract": "0.27.0",
39
43
  "@inquirer/prompts": "^7.8.6",
40
44
  "@msgpack/msgpack": "^3.1.2",
41
45
  "@pulumi/pulumi": "3.232.0",
@@ -69,7 +73,7 @@
69
73
  }
70
74
  },
71
75
  "devDependencies": {
72
- "@biomejs/biome": "2.2.0",
76
+ "@biomejs/biome": "2.5.0",
73
77
  "@types/semver": "^7.7.1",
74
78
  "@typescript/native-preview": "^7.0.0-dev.20250920.1",
75
79
  "esbuild": "^0.25.11",
@@ -6,7 +6,7 @@ import { checkPort, getPort } from "get-port-please"
6
6
  import { resolve as importMetaResolve } from "import-meta-resolve"
7
7
  import { addDevDependency } from "nypm"
8
8
  import { readPackageJSON, resolvePackageJSON } from "pkg-types"
9
- import { getBackendServices, logger } from "../shared"
9
+ import { getBackendServices, logger, readCurrentPackageVersion } from "../shared"
10
10
 
11
11
  let shuttingDown = false
12
12
 
@@ -62,16 +62,13 @@ export class DesignerCommand extends Command {
62
62
 
63
63
  const eventsPort = await getPort({ random: true, host })
64
64
 
65
- const designerPackageJsonPath = importMetaResolve(
66
- "@highstate/designer/package.json",
67
- packageJsonUrl,
68
- )
69
- const designerPackageJson = await readPackageJSON(designerPackageJsonPath)
65
+ const designerServerPath = importMetaResolve("@highstate/designer/server", packageJsonUrl)
66
+ const designerVersion = await readCurrentPackageVersion(designerServerPath)
70
67
 
71
68
  process.env.NITRO_PORT = port.toString()
72
69
  process.env.NITRO_HOST = host
73
70
  process.env.NITRO_BUN_IDLE_TIMEOUT ??= "255"
74
- process.env.NUXT_PUBLIC_VERSION = designerPackageJson.version
71
+ process.env.NUXT_PUBLIC_VERSION = designerVersion
75
72
  process.env.NUXT_PUBLIC_EVENTS_PORT = eventsPort.toString()
76
73
 
77
74
  try {
@@ -87,8 +84,7 @@ export class DesignerCommand extends Command {
87
84
  }
88
85
  }
89
86
 
90
- const serverPath = importMetaResolve("@highstate/designer/server", packageJsonUrl)
91
- void import(serverPath).catch(reject)
87
+ void import(designerServerPath).catch(reject)
92
88
  })
93
89
  } finally {
94
90
  console.log = oldConsoleLog
package/src/main.ts CHANGED
@@ -13,13 +13,14 @@ import {
13
13
  PackageUpdateReferencesCommand,
14
14
  UpdateCommand,
15
15
  } from "./commands"
16
+ import { readCurrentPackageVersion } from "./shared"
16
17
 
17
- // const { version } = await import("@highstate/cli/package.json")
18
+ const version = await readCurrentPackageVersion(import.meta.url)
18
19
 
19
20
  const cli = new Cli({
20
21
  binaryName: "highstate",
21
22
  binaryLabel: "Highstate",
22
- // binaryVersion: version,
23
+ binaryVersion: version,
23
24
  })
24
25
 
25
26
  cli.register(BuildCommand)
@@ -11,6 +11,7 @@ export * from "./schema-transformer"
11
11
  export * from "./schemas"
12
12
  export * from "./services"
13
13
  export * from "./source-hash-calculator"
14
+ export * from "./version"
14
15
  export * from "./version-bundle"
15
16
  export * from "./version-sets"
16
17
  export * from "./workspace"
@@ -316,7 +316,7 @@ function findFirstReturnArgument(node: ObjectProperty): Node | null {
316
316
  }
317
317
 
318
318
  const body = node.value.body
319
- if (!body || body.type !== "BlockStatement") {
319
+ if (body?.type !== "BlockStatement") {
320
320
  return null
321
321
  }
322
322
 
@@ -423,7 +423,7 @@ function getHelperFunctionForProperty(
423
423
  }
424
424
 
425
425
  const objectExpression = parentStack[parentStack.length - 2]
426
- if (!objectExpression || objectExpression.type !== "ObjectExpression") {
426
+ if (objectExpression?.type !== "ObjectExpression") {
427
427
  return null
428
428
  }
429
429
 
@@ -536,7 +536,7 @@ function isZodObjectCall(memberExpression: Node): boolean {
536
536
  }
537
537
 
538
538
  function startsWithZodCall(callExpression: CallExpression): boolean {
539
- if (!callExpression || callExpression.type !== "CallExpression") {
539
+ if (callExpression?.type !== "CallExpression") {
540
540
  return false
541
541
  }
542
542
 
@@ -0,0 +1,42 @@
1
+ import { readFile } from "node:fs/promises"
2
+ import { dirname, isAbsolute, join } from "node:path"
3
+ import { fileURLToPath } from "node:url"
4
+
5
+ type PackageManifest = {
6
+ version?: string
7
+ }
8
+
9
+ export async function readCurrentPackageVersion(moduleUrl: string): Promise<string> {
10
+ let directory = dirname(
11
+ moduleUrl.startsWith("file:")
12
+ ? fileURLToPath(moduleUrl)
13
+ : isAbsolute(moduleUrl)
14
+ ? moduleUrl
15
+ : process.cwd(),
16
+ )
17
+
18
+ while (true) {
19
+ const packageJsonPath = join(directory, "package.json")
20
+
21
+ try {
22
+ const packageJson = JSON.parse(await readFile(packageJsonPath, "utf8")) as PackageManifest
23
+
24
+ if (!packageJson.version) {
25
+ throw new Error(`Package version is missing from "${packageJsonPath}"`)
26
+ }
27
+
28
+ return packageJson.version
29
+ } catch (error) {
30
+ if (!(error instanceof Error) || !("code" in error && error.code === "ENOENT")) {
31
+ throw error
32
+ }
33
+ }
34
+
35
+ const parentDirectory = dirname(directory)
36
+ if (parentDirectory === directory) {
37
+ throw new Error(`Package manifest not found above "${directory}"`)
38
+ }
39
+
40
+ directory = parentDirectory
41
+ }
42
+ }