@devframes/plugin-code-server 0.10.1 → 1.1.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.
- package/dist/node/cli.mjs +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/node/setup.d.mts +68 -24
- package/dist/node/vite.mjs +1 -1
- package/dist/{node-XaSj17kb.mjs → node-60hxQVCe.mjs} +1 -1
- package/package.json +13 -13
package/dist/node/cli.mjs
CHANGED
package/dist/node/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as createCodeServerDevframe } from "../node-
|
|
1
|
+
import { t as createCodeServerDevframe } from "../node-60hxQVCe.mjs";
|
|
2
2
|
import { DEFAULT_CODE_SERVER_PORT, DEFAULT_PORT, PLUGIN_ID, STATE_KEY, getCookieSessionName } from "./constants.mjs";
|
|
3
3
|
export { DEFAULT_CODE_SERVER_PORT, DEFAULT_PORT, PLUGIN_ID, STATE_KEY, createCodeServerDevframe, createCodeServerDevframe as default, getCookieSessionName };
|
package/dist/node/setup.d.mts
CHANGED
|
@@ -223,7 +223,7 @@ interface DetectCodeServerResult {
|
|
|
223
223
|
*/
|
|
224
224
|
export declare function detectCodeServer(bin?: string, timeoutMs?: number): Promise<DetectCodeServerResult>;
|
|
225
225
|
//#endregion
|
|
226
|
-
//#region ../../node_modules/.pnpm/nostics@1.
|
|
226
|
+
//#region ../../node_modules/.pnpm/nostics@1.3.0/node_modules/nostics/dist/diagnostic-C0zzcNxA.d.mts
|
|
227
227
|
//#region src/utils.d.ts
|
|
228
228
|
/**
|
|
229
229
|
* A value of type T, or a function that resolves T from a single params object.
|
|
@@ -271,7 +271,7 @@ type Prettify<Type> = { [Key in keyof Type]: Type[Key]; };
|
|
|
271
271
|
* time. Runtime-only fields (`cause`, `sources`) from {@link DiagnosticInit}
|
|
272
272
|
* are intentionally omitted: they're only meaningful at the call site.
|
|
273
273
|
*/
|
|
274
|
-
interface DiagnosticDefinition<P = any> {
|
|
274
|
+
interface DiagnosticDefinition<P = any, Data extends Record<string, unknown> = Record<string, unknown>> {
|
|
275
275
|
/**
|
|
276
276
|
* The error message: why this failed. String, or a function of `params`.
|
|
277
277
|
*
|
|
@@ -298,6 +298,11 @@ interface DiagnosticDefinition<P = any> {
|
|
|
298
298
|
* derived from `docsBase`.
|
|
299
299
|
*/
|
|
300
300
|
docs?: string | false;
|
|
301
|
+
/**
|
|
302
|
+
* Structured information associated with this diagnostic. A function can
|
|
303
|
+
* derive the data from the same params object as `why` and `fix`.
|
|
304
|
+
*/
|
|
305
|
+
data?: ValueOrFn<Data, P>;
|
|
301
306
|
}
|
|
302
307
|
/**
|
|
303
308
|
* Runtime-only fields that can be passed alongside the interpolation params
|
|
@@ -317,12 +322,7 @@ interface DiagnosticCallParams {
|
|
|
317
322
|
*/
|
|
318
323
|
sources?: string[];
|
|
319
324
|
}
|
|
320
|
-
|
|
321
|
-
* Structured initializer for a {@link Diagnostic}. `why` is the only required
|
|
322
|
-
* field: it becomes the {@link Diagnostic.message}. The remaining fields are
|
|
323
|
-
* optional metadata that reporters and consumers can render or forward.
|
|
324
|
-
*/
|
|
325
|
-
interface DiagnosticInit extends DiagnosticCallParams {
|
|
325
|
+
interface DiagnosticInitBase extends DiagnosticCallParams {
|
|
326
326
|
/**
|
|
327
327
|
* The diagnostic code, e.g. `MATH_E001`. Appear as {@link Diagnostic.name}.
|
|
328
328
|
*/
|
|
@@ -341,21 +341,53 @@ interface DiagnosticInit extends DiagnosticCallParams {
|
|
|
341
341
|
*/
|
|
342
342
|
docs?: string;
|
|
343
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Structured initializer for a {@link Diagnostic}. `why` is the only required
|
|
346
|
+
* field: it becomes the {@link Diagnostic.message}. The remaining fields are
|
|
347
|
+
* optional metadata that reporters and consumers can render or forward.
|
|
348
|
+
*/
|
|
349
|
+
type DiagnosticInit<Data = undefined> = DiagnosticInitBase & ([Data] extends [undefined] ? {
|
|
350
|
+
data?: undefined;
|
|
351
|
+
} : {
|
|
352
|
+
data: Data;
|
|
353
|
+
});
|
|
354
|
+
/**
|
|
355
|
+
* Serializable representation returned by {@link Diagnostic.toJSON}.
|
|
356
|
+
*/
|
|
357
|
+
interface DiagnosticJSON<Data = unknown> {
|
|
358
|
+
name: string;
|
|
359
|
+
why: string;
|
|
360
|
+
fix?: string;
|
|
361
|
+
docs?: string;
|
|
362
|
+
sources?: string[];
|
|
363
|
+
cause?: unknown;
|
|
364
|
+
data: Data;
|
|
365
|
+
stack?: string;
|
|
366
|
+
}
|
|
344
367
|
/**
|
|
345
368
|
* Permissive reporter constraint used internally so reporters with 1 arg,
|
|
346
369
|
* required options, or optional options all satisfy the array constraint.
|
|
347
370
|
*
|
|
348
371
|
* @internal
|
|
349
372
|
*/
|
|
350
|
-
type AnyDiagnosticReporter = (diagnostic: Diagnostic
|
|
373
|
+
type AnyDiagnosticReporter = (diagnostic: Diagnostic<any>, options: any) => void;
|
|
351
374
|
/**
|
|
352
375
|
* Resolves the `params` type a code expects from the intersection of params
|
|
353
|
-
* across all function-typed fields, falling back to `
|
|
376
|
+
* across all function-typed fields, falling back to `unknown` when every field is
|
|
354
377
|
* static. Merged with {@link DiagnosticCallParams} at the call site.
|
|
355
378
|
*
|
|
356
379
|
* @internal
|
|
357
380
|
*/
|
|
358
|
-
type InferCodeParams<Def> = [ExtractFnParam<Def[keyof Def]>] extends [never] ?
|
|
381
|
+
type InferCodeParams<Def> = [ExtractFnParam<Def[keyof Def]>] extends [never] ? unknown : UnionToIntersection<ExtractFnParam<Def[keyof Def]>>;
|
|
382
|
+
/**
|
|
383
|
+
* Resolves the data stored by a code definition. Codes without data return a
|
|
384
|
+
* diagnostic whose data is `undefined`.
|
|
385
|
+
*
|
|
386
|
+
* @internal
|
|
387
|
+
*/
|
|
388
|
+
type InferCodeData<Def> = Def extends {
|
|
389
|
+
data: infer Data;
|
|
390
|
+
} ? Data extends ((...args: any[]) => infer ResolvedData) ? ResolvedData : Data : undefined;
|
|
359
391
|
/**
|
|
360
392
|
* The first positional argument of a {@link DiagnosticHandle} call:
|
|
361
393
|
* interpolation params merged with the runtime-only call-site fields
|
|
@@ -364,6 +396,13 @@ type InferCodeParams<Def> = [ExtractFnParam<Def[keyof Def]>] extends [never] ? {
|
|
|
364
396
|
* @internal
|
|
365
397
|
*/
|
|
366
398
|
type CallSiteParams<Params> = Params & DiagnosticCallParams;
|
|
399
|
+
/**
|
|
400
|
+
* Checks whether an object has required fields. Making every field optional
|
|
401
|
+
* changes assignability only when the original type has required fields.
|
|
402
|
+
*
|
|
403
|
+
* @internal
|
|
404
|
+
*/
|
|
405
|
+
type HasRequiredFields<Type> = Partial<Type> extends Type ? false : true;
|
|
367
406
|
/**
|
|
368
407
|
* Resolves the full argument tuple for a {@link DiagnosticHandle} call.
|
|
369
408
|
* Branches on whether params and reporter options each have required fields.
|
|
@@ -373,7 +412,7 @@ type CallSiteParams<Params> = Params & DiagnosticCallParams;
|
|
|
373
412
|
*
|
|
374
413
|
* @internal
|
|
375
414
|
*/
|
|
376
|
-
type ActionArgs<Params, ReporterOpts> = keyof ReporterOpts extends never ?
|
|
415
|
+
type ActionArgs<Params, ReporterOpts> = keyof ReporterOpts extends never ? HasRequiredFields<Params> extends false ? [params?: CallSiteParams<Params>] : [params: CallSiteParams<Params>] : HasRequiredFields<ReporterOpts> extends false ? HasRequiredFields<Params> extends false ? [params?: CallSiteParams<Params>, reporterOptions?: ReporterOpts] : [params: CallSiteParams<Params>, reporterOptions?: ReporterOpts] : HasRequiredFields<Params> extends false ? [params: CallSiteParams<Params> | undefined, reporterOptions: ReporterOpts] : [params: CallSiteParams<Params>, reporterOptions: ReporterOpts];
|
|
377
416
|
/**
|
|
378
417
|
* Per-code handle exposed by {@link defineDiagnostics}. Each code is a
|
|
379
418
|
* callable: invoke it to build the diagnostic and run every reporter, or
|
|
@@ -385,19 +424,20 @@ type ActionArgs<Params, ReporterOpts> = keyof ReporterOpts extends never ? {} ex
|
|
|
385
424
|
* throw diagnostics.MATH_E001({ name: 'x' }) // throw
|
|
386
425
|
* ```
|
|
387
426
|
*/
|
|
388
|
-
interface DiagnosticHandle<Params, ReporterOpts> {
|
|
427
|
+
interface DiagnosticHandle<Params, ReporterOpts, Data = undefined> {
|
|
389
428
|
/**
|
|
390
429
|
* Builds the diagnostic, runs every reporter, and returns the diagnostic
|
|
391
430
|
* instance. The returned diagnostic can be inspected, attached as `cause`,
|
|
392
431
|
* or thrown with `throw`.
|
|
393
432
|
*/
|
|
394
|
-
(...args: ActionArgs<Params, ReporterOpts>): Diagnostic
|
|
433
|
+
(...args: ActionArgs<Params, ReporterOpts>): Diagnostic<Data>;
|
|
395
434
|
}
|
|
396
435
|
/**
|
|
397
436
|
* Return type of {@link defineDiagnostics}.
|
|
398
437
|
*/
|
|
399
|
-
type Diagnostics<Codes extends Record<string, DiagnosticDefinition>, Reporters extends readonly AnyDiagnosticReporter[]> = { [Code in keyof Codes]: DiagnosticHandle<InferCodeParams<Codes[Code]>, Prettify<ExtractReportersOptions<Reporters
|
|
400
|
-
|
|
438
|
+
type Diagnostics<Codes extends Record<string, DiagnosticDefinition>, Reporters extends readonly AnyDiagnosticReporter[], DataOverride = never> = { [Code in keyof Codes]: DiagnosticHandle<InferCodeParams<Codes[Code]>, Prettify<ExtractReportersOptions<Reporters>>, [DataOverride] extends [never] ? InferCodeData<Codes[Code]> : DataOverride>; };
|
|
439
|
+
type StackTraceFrame = ((...args: never[]) => unknown) | (abstract new (...args: never[]) => unknown);
|
|
440
|
+
declare class Diagnostic<Data = undefined> extends Error {
|
|
401
441
|
name: string;
|
|
402
442
|
/**
|
|
403
443
|
* The diagnostic code, e.g. `MATH_E001`.
|
|
@@ -420,6 +460,10 @@ declare class Diagnostic extends Error {
|
|
|
420
460
|
* stack and should be omitted.
|
|
421
461
|
*/
|
|
422
462
|
sources?: string[];
|
|
463
|
+
/**
|
|
464
|
+
* Structured information associated with this diagnostic code.
|
|
465
|
+
*/
|
|
466
|
+
data: Data;
|
|
423
467
|
/**
|
|
424
468
|
* Alias for {@link Error.message}: the reason this diagnostic was raised.
|
|
425
469
|
*/
|
|
@@ -431,25 +475,25 @@ declare class Diagnostic extends Error {
|
|
|
431
475
|
* `defineDiagnostics` passes its action method to strip its own frames too.
|
|
432
476
|
* Ignored on engines without `Error.captureStackTrace`.
|
|
433
477
|
*/
|
|
434
|
-
constructor(init: DiagnosticInit
|
|
478
|
+
constructor(init: DiagnosticInit<Data>, captureFrom?: StackTraceFrame);
|
|
435
479
|
/**
|
|
436
480
|
* Converts the diagnostic into a serializable structured object.
|
|
437
481
|
*/
|
|
438
|
-
toJSON():
|
|
482
|
+
toJSON(): DiagnosticJSON<Data>;
|
|
439
483
|
}
|
|
440
484
|
/**
|
|
441
485
|
* Extracts the options object a reporter accepts as its 2nd argument. Returns
|
|
442
|
-
* `
|
|
486
|
+
* `unknown` when the reporter has no 2nd arg (so it contributes nothing to the
|
|
443
487
|
* merged shape).
|
|
444
488
|
*/
|
|
445
|
-
type ExtractSingleReporterOptions<Reporter> = Reporter extends ((diagnostic: Diagnostic, options: infer ReporterOpts) => any) ? IsUnknown<ReporterOpts> extends true ?
|
|
489
|
+
type ExtractSingleReporterOptions<Reporter> = Reporter extends ((diagnostic: Diagnostic, options: infer ReporterOpts) => any) ? IsUnknown<ReporterOpts> extends true ? unknown : Exclude<ReporterOpts, undefined> : unknown;
|
|
446
490
|
/**
|
|
447
491
|
* Intersects every reporter's options shape into a single object. If any
|
|
448
492
|
* reporter has a required field, the merged shape has a required field, and
|
|
449
|
-
* {@link ActionArgs}
|
|
450
|
-
*
|
|
493
|
+
* {@link ActionArgs} makes `reporterOptions` required when the merged shape
|
|
494
|
+
* has required keys.
|
|
451
495
|
*/
|
|
452
|
-
type ExtractReportersOptions<Reporters extends readonly any[]> = Reporters extends readonly [infer First, ...infer Rest] ? ExtractSingleReporterOptions<First> & ExtractReportersOptions<Rest> :
|
|
496
|
+
type ExtractReportersOptions<Reporters extends readonly any[]> = Reporters extends readonly [infer First, ...infer Rest] ? ExtractSingleReporterOptions<First> & ExtractReportersOptions<Rest> : unknown;
|
|
453
497
|
//#endregion
|
|
454
498
|
//#region src/node/diagnostics.d.ts
|
|
455
499
|
/**
|
|
@@ -495,7 +539,7 @@ export declare const diagnostics: Diagnostics<{
|
|
|
495
539
|
};
|
|
496
540
|
}, readonly [(d: Diagnostic, { method }?: {
|
|
497
541
|
method?: "log" | "warn" | "error";
|
|
498
|
-
}) => void]>;
|
|
542
|
+
}) => void], never>;
|
|
499
543
|
//#endregion
|
|
500
544
|
//#region src/node/setup.d.ts
|
|
501
545
|
/**
|
package/dist/node/vite.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { PLUGIN_ID } from "./node/constants.mjs";
|
|
|
2
2
|
import { defineDevframe } from "devframe";
|
|
3
3
|
//#region package.json
|
|
4
4
|
var name = "@devframes/plugin-code-server";
|
|
5
|
-
var version = "
|
|
5
|
+
var version = "1.1.0";
|
|
6
6
|
var description = "Devframe plugin that runs VS Code in the browser as an embedded editor panel.";
|
|
7
7
|
var homepage = "https://github.com/devframes/devframe#readme";
|
|
8
8
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devframes/plugin-code-server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"description": "Devframe plugin that runs VS Code in the browser as an embedded editor panel.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"dist"
|
|
40
40
|
],
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@devframes/plugin-code-server--assets": "
|
|
43
|
-
"devframe": "
|
|
42
|
+
"@devframes/plugin-code-server--assets": "1.1.0",
|
|
43
|
+
"devframe": "1.1.0",
|
|
44
44
|
"vite": "^8.0.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependenciesMeta": {
|
|
@@ -52,27 +52,27 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@devframes/vite": "
|
|
55
|
+
"@devframes/vite": "1.1.0",
|
|
56
56
|
"cac": "^7.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@antfu/design": "^0.4.0",
|
|
60
|
-
"@devframes/plugin-code-server--assets": "
|
|
60
|
+
"@devframes/plugin-code-server--assets": "1.1.0",
|
|
61
61
|
"@iconify-json/ph": "^1.2.2",
|
|
62
62
|
"@storybook/addon-docs": "^10.6.0",
|
|
63
63
|
"@storybook/vue3-vite": "^10.6.0",
|
|
64
|
-
"@types/node": "^26.
|
|
65
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
64
|
+
"@types/node": "^26.6.2",
|
|
65
|
+
"@vitejs/plugin-vue": "^6.0.9",
|
|
66
66
|
"colorjs.io": "^0.7.1",
|
|
67
|
-
"devframe": "
|
|
68
|
-
"h3": "^2.0.1-rc.
|
|
67
|
+
"devframe": "1.1.0",
|
|
68
|
+
"h3": "^2.0.1-rc.32",
|
|
69
69
|
"pathe": "^2.0.3",
|
|
70
70
|
"storybook": "^10.6.0",
|
|
71
71
|
"tsdown": "^0.23.0",
|
|
72
|
-
"unocss": "^66.10.
|
|
73
|
-
"vite": "^8.3.
|
|
74
|
-
"vitest": "^5.0.
|
|
75
|
-
"vue": "^3.5.
|
|
72
|
+
"unocss": "^66.10.5",
|
|
73
|
+
"vite": "^8.3.1",
|
|
74
|
+
"vitest": "^5.0.1",
|
|
75
|
+
"vue": "^3.5.43"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"build": "tsdown && vite build --config app/vite.config.ts",
|