@dsh-workbench/adapters-default 1.1.14-beta.2 → 1.1.14
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/dist/adapter-set.d.ts +3 -3
- package/dist/adapter-set.js +8 -8
- package/dist/host-actions.d.ts +2 -0
- package/dist/host-actions.js +4 -0
- package/dist/plugin-surface.d.ts +2 -3
- package/dist/plugin-surface.js +5 -5
- package/dist/probe-port.d.ts +2 -0
- package/dist/probe-port.js +5 -0
- package/dist/runtime-port.js +12 -11
- package/dist/supply-port.d.ts +2 -0
- package/dist/supply-port.js +41 -0
- package/package.json +6 -6
package/dist/adapter-set.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { DshHostContext
|
|
2
|
-
import type { AdapterSet } from '@dsh-workbench/shared/host';
|
|
1
|
+
import type { DshHostContext } from '@dsh-workbench/shared';
|
|
2
|
+
import type { AdapterSet, Seam } from '@dsh-workbench/shared/host';
|
|
3
3
|
export declare const DEFAULT_ADAPTER_SET_ID = "@dsh-workbench/adapters-default";
|
|
4
4
|
export interface DefaultAdapterSetOptions {
|
|
5
|
-
readonly
|
|
5
|
+
readonly seam?: Seam | undefined;
|
|
6
6
|
readonly logger?: {
|
|
7
7
|
info?(message: string): void;
|
|
8
8
|
warn?(message: string): void;
|
package/dist/adapter-set.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ADAPTER_SET_API_VERSION, runningVersionOf } from '@dsh-workbench/shared/host';
|
|
1
|
+
import { ADAPTER_SET_API_VERSION, runningVersionOf, seamOf } from '@dsh-workbench/shared/host';
|
|
2
2
|
import { createCommandReader, createDataReader, createGitReader, createLibReader, opencliCommandOf } from '@dsh-workbench/adapter-runtime';
|
|
3
3
|
import { dshPluginsHandler, profileDirOf } from '@dsh-workbench/adapter-supply';
|
|
4
4
|
import { createHostActions } from '@dsh-workbench/adapter-profile';
|
|
@@ -7,22 +7,22 @@ import { createPluginSurface } from './plugin-surface.js';
|
|
|
7
7
|
import { createRuntimePort } from './runtime-port.js';
|
|
8
8
|
export const DEFAULT_ADAPTER_SET_ID = '@dsh-workbench/adapters-default';
|
|
9
9
|
export function createAdapterSet(ctx, options = {}) {
|
|
10
|
-
const
|
|
10
|
+
const seam = options.seam ?? seamOf(ctx);
|
|
11
11
|
const logger = options.logger ?? ctx.logger;
|
|
12
12
|
const runtime = createRuntimePort();
|
|
13
13
|
const opencli = opencliCommandOf(ctx);
|
|
14
|
-
const supply = createSupplyPort();
|
|
14
|
+
const supply = createSupplyPort(seam === undefined ? {} : { seam });
|
|
15
15
|
return {
|
|
16
16
|
apiVersion: ADAPTER_SET_API_VERSION,
|
|
17
17
|
id: DEFAULT_ADAPTER_SET_ID,
|
|
18
18
|
version: runningVersionOf(import.meta.url) ?? '0.0.0',
|
|
19
|
-
data: createDataReader({
|
|
19
|
+
data: createDataReader({ seam, command: opencli.command }),
|
|
20
20
|
libs: createLibReader(),
|
|
21
|
-
...(
|
|
21
|
+
...(seam === undefined
|
|
22
22
|
? {}
|
|
23
23
|
: {
|
|
24
|
-
git: createGitReader({
|
|
25
|
-
commands: createCommandReader({
|
|
24
|
+
git: createGitReader({ seam, ...(logger === undefined ? {} : { logger }) }),
|
|
25
|
+
commands: createCommandReader({ seam }),
|
|
26
26
|
}),
|
|
27
27
|
supply,
|
|
28
28
|
modules: supply,
|
|
@@ -34,7 +34,7 @@ export function createAdapterSet(ctx, options = {}) {
|
|
|
34
34
|
probe: createProbePort(),
|
|
35
35
|
runtime,
|
|
36
36
|
plugins: createPluginSurface({
|
|
37
|
-
|
|
37
|
+
seam,
|
|
38
38
|
command: opencli.command,
|
|
39
39
|
...(logger === undefined ? {} : { logger }),
|
|
40
40
|
}),
|
package/dist/plugin-surface.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { PluginSurface } from '@dsh-workbench/shared/host';
|
|
1
|
+
import type { PluginSurface, Seam } from '@dsh-workbench/shared/host';
|
|
3
2
|
export declare function createPluginSurface(options: {
|
|
4
|
-
readonly
|
|
3
|
+
readonly seam?: Seam | undefined;
|
|
5
4
|
readonly command: string;
|
|
6
5
|
readonly logger?: {
|
|
7
6
|
info?(message: string): void;
|
package/dist/plugin-surface.js
CHANGED
|
@@ -4,16 +4,16 @@ export function createPluginSurface(options) {
|
|
|
4
4
|
return {
|
|
5
5
|
declarationLookup: createDeclarationLookup,
|
|
6
6
|
createUnits(input) {
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
9
|
-
throw new Error('
|
|
10
|
-
const catalog = createPluginCatalog({
|
|
7
|
+
const seam = options.seam;
|
|
8
|
+
if (seam === undefined)
|
|
9
|
+
throw new Error('没有执行缝,插件的命令面起不来。');
|
|
10
|
+
const catalog = createPluginCatalog({ seam, command: options.command });
|
|
11
11
|
return createPluginUnits({
|
|
12
12
|
registry: input.registry,
|
|
13
13
|
catalog,
|
|
14
14
|
rows: input.rows,
|
|
15
15
|
declared: input.declared,
|
|
16
|
-
opencliFor: (plugin) => createOpencli({
|
|
16
|
+
opencliFor: (plugin) => createOpencli({ seam, plugin, command: options.command, logger: options.logger }),
|
|
17
17
|
...(input.toolNames === undefined ? {} : { toolNames: input.toolNames }),
|
|
18
18
|
...(input.logger === undefined ? {} : { logger: input.logger }),
|
|
19
19
|
});
|
package/dist/runtime-port.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
|
-
import { packageRootOf } from '@dsh-workbench/shared/host';
|
|
3
|
+
import { packageRootOf, seamOf } from '@dsh-workbench/shared/host';
|
|
4
4
|
import { backgroundLine, libsBinDir } from '@dsh-workbench/adapter-runtime';
|
|
5
5
|
import { ensureLibsOpencliPeer, opencliCommandOf, opencliRunnerOf } from '@dsh-workbench/adapter-runtime';
|
|
6
|
-
import { isInstalledCopy, prependPath, runDetached, runtimeSeedPaths, runtimeSeedRootOf, seedRuntimeFiles, seedWorkbenchToolchain,
|
|
6
|
+
import { isInstalledCopy, prependPath, runDetached, runtimeSeedPaths, runtimeSeedRootOf, seedRuntimeFiles, seedWorkbenchToolchain, workshopSeedPlan, } from '@dsh-workbench/adapter-probe';
|
|
7
7
|
export function runtimePathDirs(paths) {
|
|
8
8
|
return [paths.opencliBinDir, libsBinDir(), paths.entryDir];
|
|
9
9
|
}
|
|
@@ -19,7 +19,6 @@ const OPENCLI_RUNNER_TIMEOUT_MS = 30 * 60_000;
|
|
|
19
19
|
export function createRuntimePort() {
|
|
20
20
|
return {
|
|
21
21
|
packageRoot: packageRootOf,
|
|
22
|
-
warnUnwritableRoot,
|
|
23
22
|
capabilities() {
|
|
24
23
|
return {
|
|
25
24
|
console: true,
|
|
@@ -114,6 +113,7 @@ export function createRuntimePort() {
|
|
|
114
113
|
const root = runtimeSeedRootOf(ctx);
|
|
115
114
|
if (root === null)
|
|
116
115
|
return;
|
|
116
|
+
const seam = seamOf(ctx);
|
|
117
117
|
const home = dirname(root);
|
|
118
118
|
const packageRoot = packageRootOf(options.corePackageUrl);
|
|
119
119
|
const paths = runtimeSeedPaths(root);
|
|
@@ -123,14 +123,15 @@ export function createRuntimePort() {
|
|
|
123
123
|
ensureLibsOpencliPeer();
|
|
124
124
|
for (const dir of prependRuntimePath(paths))
|
|
125
125
|
log(`PATH 前插 ${dir}`);
|
|
126
|
-
seedWorkbenchToolchain(root, log)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
126
|
+
void seedWorkbenchToolchain(root, log, seam).then(() => {
|
|
127
|
+
const plan = workshopSeedPlan(packageRoot, home, root);
|
|
128
|
+
runDetached(plan.entry, log, seam);
|
|
129
|
+
const workshopReady = existsSync(paths.workshopManifest) && existsSync(join(paths.workshop, 'node_modules'));
|
|
130
|
+
if (isInstalledCopy(packageRoot) && !workshopReady) {
|
|
131
|
+
log('DIY 工坊骨架不在:后台建起来(第一次会下载依赖,几百 MB)');
|
|
132
|
+
runDetached(plan.full, log, seam);
|
|
133
|
+
}
|
|
134
|
+
}, (error) => log(`工具链没装成:${String(error)}`));
|
|
134
135
|
},
|
|
135
136
|
};
|
|
136
137
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { cliCatalogPath, ensureLibsBinOnPath, ensureLibsOpencliPeer, isolatedHome, libInstallCommand, vendorPluginsDir } from '@dsh-workbench/adapter-runtime';
|
|
2
|
+
import { isolatedRoot } from '@dsh-workbench/shared/host';
|
|
3
|
+
import { createRegistryNotebook, isNewerVersion, latestVersion, missingReleaseParts, probeRelease } from '@dsh-workbench/adapter-profile';
|
|
4
|
+
import { opencliInstallCommand, startSelfUpdate } from '@dsh-workbench/adapter-probe';
|
|
5
|
+
import { declarationGaps, declarationRefusalOf, moduleDeclarationOf, packageRouteOf, pathDeclarationOf, pluginInstallPlan, profileDirOf, profileModules, readBundleManager, readInstalledModule, readProfilePackage, refusalReason, registryDeclarationOf, resolvePluginSource, splitNpmSpec, } from '@dsh-workbench/adapter-supply';
|
|
6
|
+
export function createSupplyPort() {
|
|
7
|
+
const port = {
|
|
8
|
+
isolatedRoot,
|
|
9
|
+
isolatedHome,
|
|
10
|
+
cliCatalogPath,
|
|
11
|
+
vendorPluginsDir,
|
|
12
|
+
runtimeInstallCommand: opencliInstallCommand,
|
|
13
|
+
afterLibInstall() {
|
|
14
|
+
ensureLibsOpencliPeer();
|
|
15
|
+
ensureLibsBinOnPath();
|
|
16
|
+
},
|
|
17
|
+
profileDirOf,
|
|
18
|
+
profileModules,
|
|
19
|
+
readInstalledModule,
|
|
20
|
+
readProfilePackage,
|
|
21
|
+
readBundleManager,
|
|
22
|
+
createRegistryNotebook,
|
|
23
|
+
declarationGaps,
|
|
24
|
+
moduleDeclarationOf,
|
|
25
|
+
registryDeclarationOf,
|
|
26
|
+
pathDeclarationOf,
|
|
27
|
+
declarationRefusalOf,
|
|
28
|
+
refusalReason,
|
|
29
|
+
latestVersion,
|
|
30
|
+
missingReleaseParts,
|
|
31
|
+
isNewerVersion,
|
|
32
|
+
pluginInstallPlan,
|
|
33
|
+
packageRouteOf,
|
|
34
|
+
probeRelease,
|
|
35
|
+
resolvePluginSource,
|
|
36
|
+
splitNpmSpec,
|
|
37
|
+
libInstallCommand,
|
|
38
|
+
startSelfUpdate,
|
|
39
|
+
};
|
|
40
|
+
return { ...port, env: port, modules: port };
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-workbench/adapters-default",
|
|
3
|
-
"version": "1.1.14
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"description": "Default host adapter set installed with @dsh-workbench/core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"dist"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@dsh-workbench/adapter-
|
|
17
|
-
"@dsh-workbench/
|
|
18
|
-
"@dsh-workbench/
|
|
19
|
-
"@dsh-workbench/adapter-runtime": "1.1.14
|
|
20
|
-
"@dsh-workbench/adapter-supply": "1.1.14
|
|
16
|
+
"@dsh-workbench/adapter-probe": "1.1.14",
|
|
17
|
+
"@dsh-workbench/adapter-profile": "1.1.14",
|
|
18
|
+
"@dsh-workbench/shared": "1.1.14",
|
|
19
|
+
"@dsh-workbench/adapter-runtime": "1.1.14",
|
|
20
|
+
"@dsh-workbench/adapter-supply": "1.1.14"
|
|
21
21
|
},
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|