@drincs/pixi-vn-ink 1.1.2 → 1.1.4
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/chunk-EKJ57YDI.mjs +102 -0
- package/dist/{chunk-HE25JM4E.mjs → chunk-V2LO62HK.mjs} +1 -1
- package/dist/index.cjs +69 -69
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/mapper.cjs +16 -16
- package/dist/mapper.mjs +16 -16
- package/dist/parser.cjs +64 -64
- package/dist/parser.d.cts +36 -3
- package/dist/parser.d.ts +36 -3
- package/dist/parser.mjs +64 -64
- package/dist/{type-Br1aIqKp.d.cts → type-BP8kOOSc.d.cts} +1 -1
- package/dist/{type-DIFR_5pl.d.ts → type-dq-kyUrF.d.ts} +1 -1
- package/dist/{types-B7f5EzP5.d.cts → types-C31N1m1a.d.cts} +27 -1
- package/dist/{types-B7f5EzP5.d.ts → types-C31N1m1a.d.ts} +27 -1
- package/dist/vite-listener.cjs +61 -61
- package/dist/vite-listener.d.cts +2 -2
- package/dist/vite-listener.d.ts +2 -2
- package/dist/vite-listener.mjs +1 -1
- package/dist/vite.cjs +68 -67
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +6 -5
- package/package.json +2 -2
- package/dist/chunk-54QJQIS3.mjs +0 -102
package/dist/parser.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { C as CompileSharedType, I as IssueType, a as InkHashtagCommandInfo, H as HashtagCommandOccurrence, D as DivertOccurrence } from './types-
|
|
2
|
-
export { b as InkValidationInfo } from './types-
|
|
1
|
+
import { C as CompileSharedType, I as IssueType, a as InkHashtagCommandInfo, H as HashtagCommandOccurrence, D as DivertOccurrence, S as SchemaValidationIssue } from './types-C31N1m1a.cjs';
|
|
2
|
+
export { b as InkValidationInfo } from './types-C31N1m1a.cjs';
|
|
3
|
+
import { ValidateFunction } from 'ajv';
|
|
3
4
|
import 'inkjs/engine/Error';
|
|
4
5
|
|
|
5
6
|
declare namespace InkCompiler {
|
|
@@ -44,6 +45,38 @@ declare namespace InkCompiler {
|
|
|
44
45
|
* target is reported only once.
|
|
45
46
|
*/
|
|
46
47
|
function getUnknownDivertTargets(source: string, knownLabels: readonly string[]): DivertOccurrence[];
|
|
48
|
+
/**
|
|
49
|
+
* Compiles a JSON Schema object into a reusable Ajv validator. Fetching the schema (from a
|
|
50
|
+
* URL, a bundled file, ...) and caching the result across calls is entirely up to the caller
|
|
51
|
+
* (e.g. `vitePluginInk` fetches by the document's own `$schema` URL and caches per URL; a VS
|
|
52
|
+
* Code extension might instead cache to disk or bundle a schema offline) — this function only
|
|
53
|
+
* ever compiles the schema object it's given.
|
|
54
|
+
*
|
|
55
|
+
* @param schema JSON Schema object to compile.
|
|
56
|
+
* @returns A compiled Ajv validator, reusable across many {@link validateAgainstJsonSchema} calls.
|
|
57
|
+
*/
|
|
58
|
+
function getSchemaValidator(schema: object): ValidateFunction;
|
|
59
|
+
/**
|
|
60
|
+
* Validates a document against a JSON Schema, returning any mismatch as a structured
|
|
61
|
+
* {@link SchemaValidationIssue} — never throws on a validation mismatch, so a schema drift
|
|
62
|
+
* never has to block a caller's build/compile step. Mismatches on an exported `PixiVNJson`
|
|
63
|
+
* payload are expected to mostly land inside `operations` (e.g. a custom hashtag-command
|
|
64
|
+
* handler returning a slightly malformed operation), so each issue includes the nearest
|
|
65
|
+
* `$origin` — the original `# ...` ink source line — when one can be traced, to make it
|
|
66
|
+
* findable.
|
|
67
|
+
*
|
|
68
|
+
* Returns plain data rather than logging/warning itself: it's up to the caller (a Vite plugin,
|
|
69
|
+
* a VS Code extension, ...) to decide how each issue is surfaced (console warning, editor
|
|
70
|
+
* diagnostic with a squiggly under `element`, ...).
|
|
71
|
+
*
|
|
72
|
+
* @param data The document to validate.
|
|
73
|
+
* @param schema Either a JSON Schema object (compiled on the fly via
|
|
74
|
+
* {@link getSchemaValidator}) or an already-compiled validator — pass a
|
|
75
|
+
* precompiled one when validating many documents against the same schema to
|
|
76
|
+
* avoid recompiling every time.
|
|
77
|
+
* @returns Array of {@link SchemaValidationIssue}, empty when the document is valid.
|
|
78
|
+
*/
|
|
79
|
+
function validateAgainstJsonSchema(data: unknown, schema: object | ValidateFunction): SchemaValidationIssue[];
|
|
47
80
|
}
|
|
48
81
|
|
|
49
|
-
export { DivertOccurrence, HashtagCommandOccurrence, InkCompiler, InkHashtagCommandInfo };
|
|
82
|
+
export { DivertOccurrence, HashtagCommandOccurrence, InkCompiler, InkHashtagCommandInfo, SchemaValidationIssue };
|
package/dist/parser.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { C as CompileSharedType, I as IssueType, a as InkHashtagCommandInfo, H as HashtagCommandOccurrence, D as DivertOccurrence } from './types-
|
|
2
|
-
export { b as InkValidationInfo } from './types-
|
|
1
|
+
import { C as CompileSharedType, I as IssueType, a as InkHashtagCommandInfo, H as HashtagCommandOccurrence, D as DivertOccurrence, S as SchemaValidationIssue } from './types-C31N1m1a.js';
|
|
2
|
+
export { b as InkValidationInfo } from './types-C31N1m1a.js';
|
|
3
|
+
import { ValidateFunction } from 'ajv';
|
|
3
4
|
import 'inkjs/engine/Error';
|
|
4
5
|
|
|
5
6
|
declare namespace InkCompiler {
|
|
@@ -44,6 +45,38 @@ declare namespace InkCompiler {
|
|
|
44
45
|
* target is reported only once.
|
|
45
46
|
*/
|
|
46
47
|
function getUnknownDivertTargets(source: string, knownLabels: readonly string[]): DivertOccurrence[];
|
|
48
|
+
/**
|
|
49
|
+
* Compiles a JSON Schema object into a reusable Ajv validator. Fetching the schema (from a
|
|
50
|
+
* URL, a bundled file, ...) and caching the result across calls is entirely up to the caller
|
|
51
|
+
* (e.g. `vitePluginInk` fetches by the document's own `$schema` URL and caches per URL; a VS
|
|
52
|
+
* Code extension might instead cache to disk or bundle a schema offline) — this function only
|
|
53
|
+
* ever compiles the schema object it's given.
|
|
54
|
+
*
|
|
55
|
+
* @param schema JSON Schema object to compile.
|
|
56
|
+
* @returns A compiled Ajv validator, reusable across many {@link validateAgainstJsonSchema} calls.
|
|
57
|
+
*/
|
|
58
|
+
function getSchemaValidator(schema: object): ValidateFunction;
|
|
59
|
+
/**
|
|
60
|
+
* Validates a document against a JSON Schema, returning any mismatch as a structured
|
|
61
|
+
* {@link SchemaValidationIssue} — never throws on a validation mismatch, so a schema drift
|
|
62
|
+
* never has to block a caller's build/compile step. Mismatches on an exported `PixiVNJson`
|
|
63
|
+
* payload are expected to mostly land inside `operations` (e.g. a custom hashtag-command
|
|
64
|
+
* handler returning a slightly malformed operation), so each issue includes the nearest
|
|
65
|
+
* `$origin` — the original `# ...` ink source line — when one can be traced, to make it
|
|
66
|
+
* findable.
|
|
67
|
+
*
|
|
68
|
+
* Returns plain data rather than logging/warning itself: it's up to the caller (a Vite plugin,
|
|
69
|
+
* a VS Code extension, ...) to decide how each issue is surfaced (console warning, editor
|
|
70
|
+
* diagnostic with a squiggly under `element`, ...).
|
|
71
|
+
*
|
|
72
|
+
* @param data The document to validate.
|
|
73
|
+
* @param schema Either a JSON Schema object (compiled on the fly via
|
|
74
|
+
* {@link getSchemaValidator}) or an already-compiled validator — pass a
|
|
75
|
+
* precompiled one when validating many documents against the same schema to
|
|
76
|
+
* avoid recompiling every time.
|
|
77
|
+
* @returns Array of {@link SchemaValidationIssue}, empty when the document is valid.
|
|
78
|
+
*/
|
|
79
|
+
function validateAgainstJsonSchema(data: unknown, schema: object | ValidateFunction): SchemaValidationIssue[];
|
|
47
80
|
}
|
|
48
81
|
|
|
49
|
-
export { DivertOccurrence, HashtagCommandOccurrence, InkCompiler, InkHashtagCommandInfo };
|
|
82
|
+
export { DivertOccurrence, HashtagCommandOccurrence, InkCompiler, InkHashtagCommandInfo, SchemaValidationIssue };
|