dropsh 0.7.0 → 0.7.1
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/README.md +25 -0
- package/dist/src/core/config.js +8 -0
- package/dist/src/plugin-api.d.ts +2 -0
- package/dist/src/plugin-api.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -662,6 +662,31 @@ export default {
|
|
|
662
662
|
`@dropsh/plugin-*` packages), so `import { DropSHPlugin } from "dropsh/plugin"`
|
|
663
663
|
is typed with no ambient `declare module`.
|
|
664
664
|
|
|
665
|
+
The connection-resolution API is available to embedders as well:
|
|
666
|
+
|
|
667
|
+
```ts
|
|
668
|
+
import {
|
|
669
|
+
resolveConfigSource,
|
|
670
|
+
resolveConnectionsDir,
|
|
671
|
+
} from "dropsh/plugin";
|
|
672
|
+
|
|
673
|
+
const connectionsDir = resolveConnectionsDir({
|
|
674
|
+
flag: "/home/me/.config/dropsh/connections",
|
|
675
|
+
});
|
|
676
|
+
const config = resolveConfigSource({
|
|
677
|
+
connection: "staging",
|
|
678
|
+
connectionsDir,
|
|
679
|
+
});
|
|
680
|
+
// config.path and config.source identify the selected config file and selector.
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
The same entry point also exports `CWD_CONFIG_FILE`, `listConnectionIds`, and
|
|
684
|
+
`listConnections`, plus the `ConfigSource`, `ConfigSourceKind`,
|
|
685
|
+
`ConnectionEntry`, `ResolveConfigSourceInput`, and `ResolveConnectionsDirInput`
|
|
686
|
+
types. These exports use the same selector precedence and connections-directory
|
|
687
|
+
semantics as the CLI; see [Named connections](#named-connections--one-config-file-per-site)
|
|
688
|
+
for the full documentation.
|
|
689
|
+
|
|
665
690
|
### Composing plugins
|
|
666
691
|
|
|
667
692
|
`composePlugins(...children)` bundles several plugins into one flat list, so an
|
package/dist/src/core/config.js
CHANGED
|
@@ -176,6 +176,14 @@ async function importConfig(filePath) {
|
|
|
176
176
|
throw new ConfigError("site section missing");
|
|
177
177
|
if (typeof site.base_url !== "string" || site.base_url.length === 0)
|
|
178
178
|
throw new ConfigError("site.base_url required");
|
|
179
|
+
// Reject rather than silently trim, so the persisted config stays canonical.
|
|
180
|
+
// A trailing slash survives into every string-concatenated URL a consumer
|
|
181
|
+
// builds from base_url — notably `${base_url}/oauth/token` — where the doubled
|
|
182
|
+
// slash addresses a route that is not the token endpoint (DROPSH-13).
|
|
183
|
+
if (site.base_url.endsWith("/")) {
|
|
184
|
+
const corrected = site.base_url.replace(/\/+$/, "");
|
|
185
|
+
throw new ConfigError(`site.base_url must not end with a trailing slash — set it to ${corrected}`);
|
|
186
|
+
}
|
|
179
187
|
return {
|
|
180
188
|
configPath,
|
|
181
189
|
raw,
|
package/dist/src/plugin-api.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export type { AnyRenderer, InteractiveRenderer, RenderContext, Renderer, RenderS
|
|
|
5
5
|
export { indexIncluded, isInteractive } from "./core/cli/render.js";
|
|
6
6
|
export type { Config, SiteConfig } from "./core/config.js";
|
|
7
7
|
export { loadConfig } from "./core/config.js";
|
|
8
|
+
export type { ConfigSource, ConfigSourceKind, ConnectionEntry, ResolveConfigSourceInput, ResolveConnectionsDirInput, } from "./core/connections.js";
|
|
9
|
+
export { CWD_CONFIG_FILE, listConnectionIds, listConnections, resolveConfigSource, resolveConnectionsDir, } from "./core/connections.js";
|
|
8
10
|
export type { HttpClient, HttpRequest } from "./core/http.js";
|
|
9
11
|
export { createHttpClient } from "./core/http.js";
|
|
10
12
|
export type { DropSHOperation, JsonApiClient, JsonApiOptions, ResourceWriteBody, } from "./core/jsonapi/client.js";
|
package/dist/src/plugin-api.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { basicAuthPlugin, basicAuthProvider } from "./core/auth/basic.js";
|
|
2
2
|
export { indexIncluded, isInteractive } from "./core/cli/render.js";
|
|
3
3
|
export { loadConfig } from "./core/config.js";
|
|
4
|
+
export { CWD_CONFIG_FILE, listConnectionIds, listConnections, resolveConfigSource, resolveConnectionsDir, } from "./core/connections.js";
|
|
4
5
|
export { createHttpClient } from "./core/http.js";
|
|
5
6
|
export { createJsonApiClient } from "./core/jsonapi/client.js";
|
|
6
7
|
export { buildPayloadFromParameters } from "./core/params/from-parameters.js";
|