pgpm 5.15.0 → 5.15.3

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.
package/commands.js CHANGED
@@ -38,11 +38,32 @@ const upgrade_1 = __importDefault(require("./commands/upgrade"));
38
38
  const verify_1 = __importDefault(require("./commands/verify"));
39
39
  const utils_2 = require("./utils");
40
40
  /**
41
- * Commands that never talk to a database and must not activate a driver.
42
- * `init` owns its own `--pglite` meaning (scaffold from the PGlite boilerplates),
43
- * and it runs before the plugin it would scaffold is even installed.
41
+ * Commands that never open a connection, so they must not activate a driver —
42
+ * a workspace-wide `engine` must not make plan/scaffolding commands depend on
43
+ * the driver plugin being installed. `init` additionally owns its own `--pglite`
44
+ * meaning (scaffold from the PGlite boilerplates), and runs before the plugin
45
+ * it scaffolds exists.
44
46
  */
45
- const ENGINE_EXEMPT_COMMANDS = new Set(['init']);
47
+ const ENGINE_EXEMPT_COMMANDS = new Set([
48
+ 'add',
49
+ 'analyze',
50
+ 'cache',
51
+ 'doctor',
52
+ 'env',
53
+ 'extension',
54
+ 'init',
55
+ 'install',
56
+ 'package',
57
+ 'plan',
58
+ 'remove',
59
+ 'rename',
60
+ 'slice',
61
+ 'sync-versions',
62
+ 'tag',
63
+ 'up',
64
+ 'update',
65
+ 'upgrade'
66
+ ]);
46
67
  const withPgTeardown = (fn, skipTeardown = false) => async (...args) => {
47
68
  try {
48
69
  await fn(...args);
package/esm/commands.js CHANGED
@@ -32,11 +32,32 @@ import upgrade from './commands/upgrade';
32
32
  import verify from './commands/verify';
33
33
  import { activateEngine, deactivateEngine, engineCommandBlocker, getActiveEngine, usageText } from './utils';
34
34
  /**
35
- * Commands that never talk to a database and must not activate a driver.
36
- * `init` owns its own `--pglite` meaning (scaffold from the PGlite boilerplates),
37
- * and it runs before the plugin it would scaffold is even installed.
35
+ * Commands that never open a connection, so they must not activate a driver —
36
+ * a workspace-wide `engine` must not make plan/scaffolding commands depend on
37
+ * the driver plugin being installed. `init` additionally owns its own `--pglite`
38
+ * meaning (scaffold from the PGlite boilerplates), and runs before the plugin
39
+ * it scaffolds exists.
38
40
  */
39
- const ENGINE_EXEMPT_COMMANDS = new Set(['init']);
41
+ const ENGINE_EXEMPT_COMMANDS = new Set([
42
+ 'add',
43
+ 'analyze',
44
+ 'cache',
45
+ 'doctor',
46
+ 'env',
47
+ 'extension',
48
+ 'init',
49
+ 'install',
50
+ 'package',
51
+ 'plan',
52
+ 'remove',
53
+ 'rename',
54
+ 'slice',
55
+ 'sync-versions',
56
+ 'tag',
57
+ 'up',
58
+ 'update',
59
+ 'upgrade'
60
+ ]);
40
61
  const withPgTeardown = (fn, skipTeardown = false) => async (...args) => {
41
62
  try {
42
63
  await fn(...args);
@@ -1,6 +1,6 @@
1
1
  import { PGPM_DRIVER_EXPORT, } from '@pgpmjs/types';
2
2
  import { createRequire } from 'node:module';
3
- import { join } from 'node:path';
3
+ import { resolve } from 'node:path';
4
4
  /** Package name of the built-in PGlite driver plugin (the `--pglite` alias). */
5
5
  export const PGLITE_DRIVER_PLUGIN = '@pgpmjs/pglite-adapter';
6
6
  /**
@@ -56,8 +56,9 @@ export async function activateDriver(configured, override, cwd) {
56
56
  if (!cfg)
57
57
  return undefined;
58
58
  // A require bound to the consumer's project directory. `createRequire` is the
59
- // one primitive available and identical in both CJS and ESM runtimes.
60
- const requireFrom = createRequire(join(cwd, 'package.json'));
59
+ // one primitive available and identical in both CJS and ESM runtimes; it
60
+ // requires an absolute path, and `cwd` may come from a relative `--cwd`.
61
+ const requireFrom = createRequire(resolve(cwd, 'package.json'));
61
62
  let mod;
62
63
  try {
63
64
  const entry = requireFrom.resolve(cfg.plugin);
@@ -1,5 +1,6 @@
1
1
  import { getEnvOptions } from '@pgpmjs/env';
2
2
  import { BUILTIN_ENGINES, DEFAULT_ENGINE, } from '@pgpmjs/types';
3
+ import { resolve } from 'node:path';
3
4
  import { activateDriver, driverOverrideFromArgv, PGLITE_DRIVER_PLUGIN } from './driver';
4
5
  /** Everything a real Postgres server can do — the built-in `pg` engine. */
5
6
  export const SERVER_CAPABILITIES = {
@@ -75,9 +76,10 @@ export const getActiveEngine = () => active ?? { engine: { name: DEFAULT_ENGINE
75
76
  * so the unmodified pgpm engine runs against the selected backend.
76
77
  */
77
78
  export const activateEngine = async (argv, cwd = process.cwd()) => {
78
- const config = getEnvOptions({}, cwd);
79
+ const dir = resolve(cwd);
80
+ const config = getEnvOptions({}, dir);
79
81
  const engine = resolveEngine(argv, config);
80
- const session = await activateDriver(engine.driver, undefined, cwd);
82
+ const session = await activateDriver(engine.driver, undefined, dir);
81
83
  active = { engine, session, capabilities: session?.capabilities ?? SERVER_CAPABILITIES };
82
84
  return active;
83
85
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgpm",
3
- "version": "5.15.0",
3
+ "version": "5.15.3",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "PostgreSQL Package Manager - Database migration and package management CLI",
6
6
  "main": "index.js",
@@ -46,20 +46,20 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@inquirerer/utils": "^3.3.9",
49
- "@pgpmjs/core": "^7.16.0",
50
- "@pgpmjs/env": "^2.39.0",
51
- "@pgpmjs/export": "^1.12.3",
52
- "@pgpmjs/logger": "^2.22.0",
53
- "@pgpmjs/slice": "^0.10.2",
54
- "@pgpmjs/types": "^2.47.0",
49
+ "@pgpmjs/core": "^7.17.2",
50
+ "@pgpmjs/env": "^2.39.2",
51
+ "@pgpmjs/export": "^1.12.6",
52
+ "@pgpmjs/logger": "^2.22.1",
53
+ "@pgpmjs/slice": "^0.11.2",
54
+ "@pgpmjs/types": "^2.48.1",
55
55
  "@pgsql/quotes": "^18.1.0",
56
56
  "appstash": "^0.7.0",
57
57
  "find-and-require-package-json": "^0.9.1",
58
58
  "genomic": "^5.6.2",
59
59
  "inquirerer": "^4.9.1",
60
60
  "js-yaml": "^4.1.0",
61
- "pg-cache": "^3.23.2",
62
- "pg-env": "^1.26.0",
61
+ "pg-cache": "^3.23.4",
62
+ "pg-env": "^1.26.1",
63
63
  "pgsql-deparser": "^18.1.1",
64
64
  "semver": "^7.8.1",
65
65
  "shelljs": "^0.10.0",
@@ -77,5 +77,5 @@
77
77
  "pg",
78
78
  "pgsql"
79
79
  ],
80
- "gitHead": "0286d994d98717cb9b28842233d2db6d1e37c48e"
80
+ "gitHead": "a430897efa1488ec24fc636f0d5023207bba7ba7"
81
81
  }
package/utils/driver.js CHANGED
@@ -62,8 +62,9 @@ async function activateDriver(configured, override, cwd) {
62
62
  if (!cfg)
63
63
  return undefined;
64
64
  // A require bound to the consumer's project directory. `createRequire` is the
65
- // one primitive available and identical in both CJS and ESM runtimes.
66
- const requireFrom = (0, node_module_1.createRequire)((0, node_path_1.join)(cwd, 'package.json'));
65
+ // one primitive available and identical in both CJS and ESM runtimes; it
66
+ // requires an absolute path, and `cwd` may come from a relative `--cwd`.
67
+ const requireFrom = (0, node_module_1.createRequire)((0, node_path_1.resolve)(cwd, 'package.json'));
67
68
  let mod;
68
69
  try {
69
70
  const entry = requireFrom.resolve(cfg.plugin);
package/utils/engine.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deactivateEngine = exports.activateEngine = exports.getActiveEngine = exports.resolveEngine = exports.engineDefinitions = exports.SERVER_CAPABILITIES = void 0;
4
4
  const env_1 = require("@pgpmjs/env");
5
5
  const types_1 = require("@pgpmjs/types");
6
+ const node_path_1 = require("node:path");
6
7
  const driver_1 = require("./driver");
7
8
  /** Everything a real Postgres server can do — the built-in `pg` engine. */
8
9
  exports.SERVER_CAPABILITIES = {
@@ -81,9 +82,10 @@ exports.getActiveEngine = getActiveEngine;
81
82
  * so the unmodified pgpm engine runs against the selected backend.
82
83
  */
83
84
  const activateEngine = async (argv, cwd = process.cwd()) => {
84
- const config = (0, env_1.getEnvOptions)({}, cwd);
85
+ const dir = (0, node_path_1.resolve)(cwd);
86
+ const config = (0, env_1.getEnvOptions)({}, dir);
85
87
  const engine = (0, exports.resolveEngine)(argv, config);
86
- const session = await (0, driver_1.activateDriver)(engine.driver, undefined, cwd);
88
+ const session = await (0, driver_1.activateDriver)(engine.driver, undefined, dir);
87
89
  active = { engine, session, capabilities: session?.capabilities ?? exports.SERVER_CAPABILITIES };
88
90
  return active;
89
91
  };