@graphql-markdown/core 1.19.0 → 1.21.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/assets/generated.md +1 -8
- package/dist/config.d.ts +9 -55
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +24 -39
- package/dist/const/patterns.d.ts +9 -9
- package/dist/const/patterns.d.ts.map +1 -1
- package/dist/const/patterns.js +9 -9
- package/dist/diff.d.ts.map +1 -1
- package/dist/diff.js +1 -34
- package/dist/directives/normalize.d.ts +2 -2
- package/dist/directives/normalize.d.ts.map +1 -1
- package/dist/directives/normalize.js +3 -1
- package/dist/directives/validation.d.ts.map +1 -1
- package/dist/event-emitter.d.ts +7 -2
- package/dist/event-emitter.d.ts.map +1 -1
- package/dist/event-emitter.js +32 -23
- package/dist/event-handlers.d.ts.map +1 -1
- package/dist/event-map.d.ts +2 -0
- package/dist/event-map.d.ts.map +1 -1
- package/dist/event-map.js +3 -0
- package/dist/events/diff-check.d.ts +7 -8
- package/dist/events/diff-check.d.ts.map +1 -1
- package/dist/events/diff-check.js +3 -6
- package/dist/events/diff-events.d.ts.map +1 -1
- package/dist/events/generate-index-metafile-events.d.ts.map +1 -1
- package/dist/events/generate-index-metafile.d.ts +7 -8
- package/dist/events/generate-index-metafile.d.ts.map +1 -1
- package/dist/events/generate-index-metafile.js +3 -6
- package/dist/events/index.d.ts +2 -3
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +21 -21
- package/dist/events/print-type-events.d.ts +5 -2
- package/dist/events/print-type-events.d.ts.map +1 -1
- package/dist/events/print-type-events.js +5 -2
- package/dist/events/print-type.d.ts +4 -78
- package/dist/events/print-type.d.ts.map +1 -1
- package/dist/events/print-type.js +3 -66
- package/dist/events/render-files-events.d.ts +13 -0
- package/dist/events/render-files-events.d.ts.map +1 -0
- package/dist/events/render-files-events.js +15 -0
- package/dist/events/render-files.d.ts +26 -0
- package/dist/events/render-files.d.ts.map +1 -0
- package/dist/events/render-files.js +20 -0
- package/dist/events/render-homepage-events.d.ts.map +1 -1
- package/dist/events/render-homepage.d.ts +5 -6
- package/dist/events/render-homepage.d.ts.map +1 -1
- package/dist/events/render-homepage.js +3 -6
- package/dist/events/render-root-types-events.d.ts.map +1 -1
- package/dist/events/render-root-types.d.ts +5 -6
- package/dist/events/render-root-types.d.ts.map +1 -1
- package/dist/events/render-root-types.js +3 -6
- package/dist/events/render-type-entities-events.d.ts.map +1 -1
- package/dist/events/render-type-entities.d.ts +10 -7
- package/dist/events/render-type-entities.d.ts.map +1 -1
- package/dist/events/render-type-entities.js +3 -6
- package/dist/events/schema-events.d.ts.map +1 -1
- package/dist/events/schema-load.d.ts +7 -8
- package/dist/events/schema-load.d.ts.map +1 -1
- package/dist/events/schema-load.js +3 -6
- package/dist/generator.d.ts +3 -14
- package/dist/generator.d.ts.map +1 -1
- package/dist/generator.js +16 -11
- package/dist/graphql-config.d.ts +0 -5
- package/dist/graphql-config.d.ts.map +1 -1
- package/dist/graphql-config.js +8 -38
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -13
- package/dist/options/builder.d.ts +13 -13
- package/dist/options/builder.d.ts.map +1 -1
- package/dist/options/builder.js +25 -25
- package/dist/printer.d.ts +9 -10
- package/dist/printer.d.ts.map +1 -1
- package/dist/printer.js +11 -53
- package/dist/renderer.d.ts +5 -5
- package/dist/renderer.d.ts.map +1 -1
- package/dist/renderer.js +24 -15
- package/package.json +24 -16
- package/dist/events/base.d.ts +0 -119
- package/dist/events/base.d.ts.map +0 -1
- package/dist/events/base.js +0 -149
package/assets/generated.md
CHANGED
|
@@ -9,11 +9,4 @@ pagination_prev: null
|
|
|
9
9
|
sidebar_class_name: navbar__toggle
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
This documentation has been automatically generated from the GraphQL schema.
|
|
13
|
-
|
|
14
|
-
Use the docs in the sidebar to find out how to use the schema:
|
|
15
|
-
|
|
16
|
-
- **Allowed operations**: queries and mutations.
|
|
17
|
-
- **Schema-defined types**: scalars, objects, enums, interfaces, unions, and input objects.
|
|
18
|
-
|
|
19
|
-
<small><i>Generated on ##generated-date-time##.</i></small>
|
|
12
|
+
This documentation has been automatically generated from the GraphQL schema with [GraphQL-Markdown](https://graphql-markdown.dev/).
|
package/dist/config.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @packageDocumentation
|
|
17
17
|
*/
|
|
18
|
-
import type { CliOptions, ConfigDocOptions, ConfigOptions, ConfigPrintTypeOptions, CustomDirective,
|
|
18
|
+
import type { CliOptions, ConfigDocOptions, ConfigOptions, ConfigPrintTypeOptions, CustomDirective, DirectiveName, GroupByDirectiveOptions, Maybe, Options, TypeDiffMethod, TypeHierarchyObjectType, TypeHierarchyType, TypeHierarchyValueType } from "@graphql-markdown/types";
|
|
19
19
|
/**
|
|
20
20
|
* Type hierarchy options for organizing schema documentation.
|
|
21
21
|
*
|
|
@@ -97,8 +97,9 @@ export declare const DEFAULT_HIERARCHY: {
|
|
|
97
97
|
* @public
|
|
98
98
|
* @see {@link Options} for the complete configuration interface
|
|
99
99
|
*/
|
|
100
|
-
export declare const DEFAULT_OPTIONS: Readonly<Pick<ConfigOptions, "customDirective" | "groupByDirective" | "loaders"> & Required<Omit<ConfigOptions, "customDirective" | "groupByDirective" | "loaders" | "mdxParser" | "printTypeOptions">>> & {
|
|
101
|
-
printTypeOptions: Required<Omit<ConfigPrintTypeOptions, "hierarchy">> & {
|
|
100
|
+
export declare const DEFAULT_OPTIONS: Readonly<Pick<ConfigOptions, "customDirective" | "groupByDirective" | "loaders"> & Required<Omit<ConfigOptions, "customDirective" | "formatter" | "groupByDirective" | "loaders" | "mdxParser" | "printTypeOptions">>> & {
|
|
101
|
+
printTypeOptions: Required<Omit<ConfigPrintTypeOptions, "exampleSection" | "hierarchy">> & {
|
|
102
|
+
exampleSection: ConfigPrintTypeOptions["exampleSection"];
|
|
102
103
|
hierarchy: Required<Pick<TypeHierarchyObjectType, TypeHierarchy.API>>;
|
|
103
104
|
};
|
|
104
105
|
};
|
|
@@ -233,17 +234,8 @@ export declare const getCustomDirectives: (customDirectiveOptions: Maybe<CustomD
|
|
|
233
234
|
* @see {@link DiffMethod} for available diff methods
|
|
234
235
|
*/
|
|
235
236
|
export declare const getForcedDiffMethod: () => TypeDiffMethod;
|
|
236
|
-
export declare const getNormalizedDiffMethod: (diff: TypeDiffMethod) => TypeDiffMethod;
|
|
237
237
|
export declare const getDiffMethod: (diff: TypeDiffMethod) => TypeDiffMethod;
|
|
238
|
-
|
|
239
|
-
* Placeholder function for handling deprecated document options.
|
|
240
|
-
* Currently returns an empty object as these options are deprecated.
|
|
241
|
-
*
|
|
242
|
-
* @param _cliOpts - Deprecated CLI options (unused)
|
|
243
|
-
* @param _configOptions - Deprecated config options (unused)
|
|
244
|
-
* @returns An empty object
|
|
245
|
-
*/
|
|
246
|
-
export declare const parseDeprecatedDocOptions: (_cliOpts: Maybe<Omit<DeprecatedCliOptions, "never">>, _configOptions: Maybe<Omit<DeprecatedConfigDocOptions, "never">>) => Record<string, never>;
|
|
238
|
+
export declare const parseDeprecatedDocOptions: (_cliOpts?: Maybe<CliOptions>, _configOptions?: Maybe<ConfigDocOptions>) => Record<string, never>;
|
|
247
239
|
/**
|
|
248
240
|
* Builds the document options by merging CLI options, config file options, and defaults.
|
|
249
241
|
* Handles index generation flag and front matter configuration.
|
|
@@ -264,7 +256,7 @@ export declare const parseDeprecatedDocOptions: (_cliOpts: Maybe<Omit<Deprecated
|
|
|
264
256
|
* // }
|
|
265
257
|
* ```
|
|
266
258
|
*/
|
|
267
|
-
export declare const getDocOptions: (cliOpts?: Maybe<CliOptions
|
|
259
|
+
export declare const getDocOptions: (cliOpts?: Maybe<CliOptions>, configOptions?: Maybe<ConfigDocOptions>) => Required<ConfigDocOptions>;
|
|
268
260
|
/**
|
|
269
261
|
* Resolves the type hierarchy configuration by merging CLI and config file options.
|
|
270
262
|
* Validates that CLI and config don't specify conflicting hierarchy types.
|
|
@@ -289,47 +281,9 @@ export declare const getDocOptions: (cliOpts?: Maybe<CliOptions & Omit<Deprecate
|
|
|
289
281
|
* ```
|
|
290
282
|
* @see {@link TypeHierarchy} for available hierarchy types
|
|
291
283
|
*/
|
|
292
|
-
export declare const getTypeHierarchyOption: (cliOption?: Maybe<TypeHierarchyValueType>, configOption?: Maybe<TypeHierarchyType>) => Maybe<
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
* Currently returns an empty object as these options are deprecated.
|
|
296
|
-
*
|
|
297
|
-
* @param _cliOpts - Deprecated CLI options (unused)
|
|
298
|
-
* @param _configOptions - Deprecated config options (unused)
|
|
299
|
-
* @returns An empty object
|
|
300
|
-
*/
|
|
301
|
-
export declare const parseDeprecatedPrintTypeOptions: (_cliOpts: Maybe<Omit<DeprecatedCliOptions, "never">>, _configOptions: Maybe<Omit<DeprecatedConfigPrintTypeOptions, "never">>) => Record<string, never>;
|
|
302
|
-
/**
|
|
303
|
-
* Builds the print type options by merging CLI options, config file options, and defaults.
|
|
304
|
-
* Handles various formatting options for type documentation.
|
|
305
|
-
*
|
|
306
|
-
* @param cliOpts - CLI options for print type configuration
|
|
307
|
-
* @param configOptions - Config file options for print type configuration
|
|
308
|
-
* @returns The resolved print type options with all required fields
|
|
309
|
-
* @example
|
|
310
|
-
* ```typescript
|
|
311
|
-
* const cliOptions = { noCode: true, deprecated: "group" };
|
|
312
|
-
* const configOptions = {
|
|
313
|
-
* exampleSection: true,
|
|
314
|
-
* hierarchy: "entity"
|
|
315
|
-
* };
|
|
316
|
-
*
|
|
317
|
-
* const printOptions = getPrintTypeOptions(cliOptions, configOptions);
|
|
318
|
-
* console.log(printOptions);
|
|
319
|
-
* // {
|
|
320
|
-
* // codeSection: false, // Disabled via noCode CLI flag
|
|
321
|
-
* // deprecated: "group", // From CLI
|
|
322
|
-
* // exampleSection: true, // From config
|
|
323
|
-
* // parentTypePrefix: true, // Default value
|
|
324
|
-
* // relatedTypeSection: true, // Default value
|
|
325
|
-
* // typeBadges: true, // Default value
|
|
326
|
-
* // hierarchy: { entity: {} } // Parsed from config
|
|
327
|
-
* // }
|
|
328
|
-
* ```
|
|
329
|
-
* @see {@link DeprecatedOption} for deprecated handling options
|
|
330
|
-
* @see {@link getTypeHierarchyOption} for hierarchy resolution
|
|
331
|
-
*/
|
|
332
|
-
export declare const getPrintTypeOptions: (cliOpts: Maybe<CliOptions & Omit<DeprecatedCliOptions, "never">>, configOptions: Maybe<ConfigPrintTypeOptions & Omit<DeprecatedConfigPrintTypeOptions, "never">>) => Required<ConfigPrintTypeOptions>;
|
|
284
|
+
export declare const getTypeHierarchyOption: (cliOption?: Maybe<TypeHierarchyValueType>, configOption?: Maybe<TypeHierarchyType>) => Maybe<TypeHierarchyObjectType>;
|
|
285
|
+
export declare const parseDeprecatedFormatterOption: (cliOpts?: Maybe<CliOptions>, configOptions?: Maybe<ConfigOptions>) => Maybe<string>;
|
|
286
|
+
export declare const parseDeprecatedPrintTypeOptions: (_cliOpts?: Maybe<CliOptions>, _configOptions?: Maybe<ConfigPrintTypeOptions>) => Record<string, never>;
|
|
333
287
|
/**
|
|
334
288
|
* Parses and validates the groupByDirective option string format.
|
|
335
289
|
* The format should be \@directive(field|=fallback) where:
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"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"}
|
package/dist/config.js
CHANGED
|
@@ -17,10 +17,11 @@
|
|
|
17
17
|
* @packageDocumentation
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.buildConfig = exports.parseHomepageOption = exports.parseGroupByOption = exports.
|
|
20
|
+
exports.buildConfig = exports.parseHomepageOption = exports.parseGroupByOption = exports.parseDeprecatedPrintTypeOptions = exports.parseDeprecatedFormatterOption = exports.getTypeHierarchyOption = exports.getDocOptions = exports.parseDeprecatedDocOptions = exports.getDiffMethod = exports.getForcedDiffMethod = exports.getCustomDirectives = exports.getVisibilityDirectives = exports.getSkipDocDirectives = exports.getOnlyDocDirectives = exports.getDocDirective = exports.DEFAULT_OPTIONS = exports.DEFAULT_HIERARCHY = exports.ASSET_HOMEPAGE_LOCATION = exports.PACKAGE_NAME = exports.DOCS_URL = exports.DeprecatedOption = exports.DiffMethod = exports.TypeHierarchy = void 0;
|
|
21
21
|
const node_path_1 = require("node:path");
|
|
22
22
|
const node_os_1 = require("node:os");
|
|
23
23
|
const deepmerge_1 = require("@fastify/deepmerge");
|
|
24
|
+
const logger_1 = require("@graphql-markdown/logger");
|
|
24
25
|
const graphql_config_1 = require("./graphql-config");
|
|
25
26
|
const patterns_1 = require("./const/patterns");
|
|
26
27
|
const validation_1 = require("./directives/validation");
|
|
@@ -125,13 +126,10 @@ exports.DEFAULT_OPTIONS = {
|
|
|
125
126
|
loaders: undefined,
|
|
126
127
|
metatags: [],
|
|
127
128
|
pretty: false,
|
|
128
|
-
printer: "@graphql-markdown/printer-legacy",
|
|
129
129
|
printTypeOptions: {
|
|
130
|
-
codeSection: true,
|
|
131
130
|
deprecated: DeprecatedOption.DEFAULT,
|
|
132
|
-
exampleSection:
|
|
131
|
+
exampleSection: undefined,
|
|
133
132
|
parentTypePrefix: true,
|
|
134
|
-
relatedTypeSection: true,
|
|
135
133
|
typeBadges: true,
|
|
136
134
|
},
|
|
137
135
|
rootPath: "./docs",
|
|
@@ -330,19 +328,10 @@ exports.getForcedDiffMethod = getForcedDiffMethod;
|
|
|
330
328
|
const getNormalizedDiffMethod = (diff) => {
|
|
331
329
|
return diff.toLocaleUpperCase();
|
|
332
330
|
};
|
|
333
|
-
exports.getNormalizedDiffMethod = getNormalizedDiffMethod;
|
|
334
331
|
const getDiffMethod = (diff) => {
|
|
335
|
-
return
|
|
332
|
+
return getNormalizedDiffMethod(diff);
|
|
336
333
|
};
|
|
337
334
|
exports.getDiffMethod = getDiffMethod;
|
|
338
|
-
/**
|
|
339
|
-
* Placeholder function for handling deprecated document options.
|
|
340
|
-
* Currently returns an empty object as these options are deprecated.
|
|
341
|
-
*
|
|
342
|
-
* @param _cliOpts - Deprecated CLI options (unused)
|
|
343
|
-
* @param _configOptions - Deprecated config options (unused)
|
|
344
|
-
* @returns An empty object
|
|
345
|
-
*/
|
|
346
335
|
const parseDeprecatedDocOptions = (_cliOpts, _configOptions) => {
|
|
347
336
|
return {};
|
|
348
337
|
};
|
|
@@ -442,14 +431,16 @@ const getTypeHierarchyOption = (cliOption, configOption) => {
|
|
|
442
431
|
return cliHierarchy ?? configHierarchy ?? exports.DEFAULT_HIERARCHY;
|
|
443
432
|
};
|
|
444
433
|
exports.getTypeHierarchyOption = getTypeHierarchyOption;
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
434
|
+
const parseDeprecatedFormatterOption = (cliOpts, configOptions) => {
|
|
435
|
+
const legacyCli = cliOpts?.mdxParser ?? null; // NOSONAR typescript:S1874
|
|
436
|
+
const legacyConfig = configOptions?.mdxParser; // NOSONAR typescript:S1874
|
|
437
|
+
if (legacyCli !== null ||
|
|
438
|
+
(legacyConfig !== undefined && legacyConfig !== null)) {
|
|
439
|
+
(0, logger_1.log)(`Setting "mdxParser" is deprecated and will be removed in a future version. Use "formatter" instead.`, logger_1.LogLevel.warn);
|
|
440
|
+
}
|
|
441
|
+
return (cliOpts?.formatter ?? legacyCli ?? configOptions?.formatter ?? legacyConfig);
|
|
442
|
+
};
|
|
443
|
+
exports.parseDeprecatedFormatterOption = parseDeprecatedFormatterOption;
|
|
453
444
|
const parseDeprecatedPrintTypeOptions = (_cliOpts, _configOptions) => {
|
|
454
445
|
return {};
|
|
455
446
|
};
|
|
@@ -463,20 +454,18 @@ exports.parseDeprecatedPrintTypeOptions = parseDeprecatedPrintTypeOptions;
|
|
|
463
454
|
* @returns The resolved print type options with all required fields
|
|
464
455
|
* @example
|
|
465
456
|
* ```typescript
|
|
466
|
-
* const cliOptions = {
|
|
457
|
+
* const cliOptions = { deprecated: "group" };
|
|
467
458
|
* const configOptions = {
|
|
468
|
-
* exampleSection:
|
|
459
|
+
* exampleSection: { directive: "example" },
|
|
469
460
|
* hierarchy: "entity"
|
|
470
461
|
* };
|
|
471
462
|
*
|
|
472
463
|
* const printOptions = getPrintTypeOptions(cliOptions, configOptions);
|
|
473
464
|
* console.log(printOptions);
|
|
474
465
|
* // {
|
|
475
|
-
* // codeSection: false, // Disabled via noCode CLI flag
|
|
476
466
|
* // deprecated: "group", // From CLI
|
|
477
|
-
* // exampleSection:
|
|
467
|
+
* // exampleSection: { directive: "example" }, // From config
|
|
478
468
|
* // parentTypePrefix: true, // Default value
|
|
479
|
-
* // relatedTypeSection: true, // Default value
|
|
480
469
|
* // typeBadges: true, // Default value
|
|
481
470
|
* // hierarchy: { entity: {} } // Parsed from config
|
|
482
471
|
* // }
|
|
@@ -485,26 +474,19 @@ exports.parseDeprecatedPrintTypeOptions = parseDeprecatedPrintTypeOptions;
|
|
|
485
474
|
* @see {@link getTypeHierarchyOption} for hierarchy resolution
|
|
486
475
|
*/
|
|
487
476
|
const getPrintTypeOptions = (cliOpts, configOptions) => {
|
|
488
|
-
const deprecated = (0, exports.parseDeprecatedPrintTypeOptions)(cliOpts, configOptions);
|
|
489
477
|
return {
|
|
490
|
-
...deprecated,
|
|
491
|
-
codeSection: (!cliOpts?.noCode && configOptions?.codeSection) ??
|
|
492
|
-
exports.DEFAULT_OPTIONS.printTypeOptions.codeSection,
|
|
493
478
|
deprecated: (cliOpts?.deprecated ??
|
|
494
479
|
configOptions?.deprecated ??
|
|
495
480
|
exports.DEFAULT_OPTIONS.printTypeOptions.deprecated).toLocaleLowerCase(),
|
|
496
|
-
exampleSection:
|
|
481
|
+
exampleSection: configOptions?.exampleSection ??
|
|
497
482
|
exports.DEFAULT_OPTIONS.printTypeOptions.exampleSection,
|
|
498
483
|
parentTypePrefix: (!cliOpts?.noParentType && configOptions?.parentTypePrefix) ??
|
|
499
484
|
exports.DEFAULT_OPTIONS.printTypeOptions.parentTypePrefix,
|
|
500
|
-
relatedTypeSection: (!cliOpts?.noRelatedType && configOptions?.relatedTypeSection) ??
|
|
501
|
-
exports.DEFAULT_OPTIONS.printTypeOptions.relatedTypeSection,
|
|
502
485
|
typeBadges: (!cliOpts?.noTypeBadges && configOptions?.typeBadges) ??
|
|
503
486
|
exports.DEFAULT_OPTIONS.printTypeOptions.typeBadges,
|
|
504
487
|
hierarchy: (0, exports.getTypeHierarchyOption)(cliOpts?.hierarchy, configOptions?.hierarchy),
|
|
505
488
|
};
|
|
506
489
|
};
|
|
507
|
-
exports.getPrintTypeOptions = getPrintTypeOptions;
|
|
508
490
|
/**
|
|
509
491
|
* Parses and validates the groupByDirective option string format.
|
|
510
492
|
* The format should be \@directive(field|=fallback) where:
|
|
@@ -563,6 +545,10 @@ exports.parseHomepageOption = parseHomepageOption;
|
|
|
563
545
|
const buildConfig = async (configFileOpts, cliOpts, id = "default") => {
|
|
564
546
|
cliOpts ??= {};
|
|
565
547
|
const graphqlConfig = await (0, graphql_config_1.loadConfiguration)(id);
|
|
548
|
+
(0, exports.parseDeprecatedPrintTypeOptions)(cliOpts, {
|
|
549
|
+
...graphqlConfig?.printTypeOptions,
|
|
550
|
+
...configFileOpts?.printTypeOptions,
|
|
551
|
+
});
|
|
566
552
|
const config = (0, deepmerge_1.deepmerge)()({ ...exports.DEFAULT_OPTIONS, ...graphqlConfig }, configFileOpts ?? {});
|
|
567
553
|
const { onlyDocDirective, skipDocDirective } = (0, exports.getVisibilityDirectives)(cliOpts, config);
|
|
568
554
|
// Build options using consistent precedence: CLI > Config > Default
|
|
@@ -604,13 +590,12 @@ const buildConfig = async (configFileOpts, cliOpts, id = "default") => {
|
|
|
604
590
|
id: id ?? exports.DEFAULT_OPTIONS.id,
|
|
605
591
|
linkRoot,
|
|
606
592
|
loaders: config.loaders,
|
|
607
|
-
|
|
593
|
+
formatter: (0, exports.parseDeprecatedFormatterOption)(cliOpts, config),
|
|
608
594
|
metatags: config.metatags ?? exports.DEFAULT_OPTIONS.metatags,
|
|
609
595
|
onlyDocDirective,
|
|
610
596
|
outputDir: (0, node_path_1.join)(rootPath, baseURL),
|
|
611
597
|
prettify,
|
|
612
|
-
|
|
613
|
-
printTypeOptions: (0, exports.getPrintTypeOptions)(cliOpts, config.printTypeOptions),
|
|
598
|
+
printTypeOptions: getPrintTypeOptions(cliOpts, config.printTypeOptions),
|
|
614
599
|
schemaLocation,
|
|
615
600
|
skipDocDirective,
|
|
616
601
|
tmpDir,
|
package/dist/const/patterns.d.ts
CHANGED
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
export declare const PATTERNS: {
|
|
20
20
|
/**
|
|
21
21
|
* Matches directive names with named capture groups.
|
|
22
|
-
* Captures the directive name after the
|
|
22
|
+
* Captures the directive name after the \@ symbol.
|
|
23
23
|
*
|
|
24
|
-
* @pattern
|
|
24
|
+
* @pattern `^\@(?<directive>\w+)$`
|
|
25
25
|
* @example
|
|
26
|
-
* - "
|
|
27
|
-
* - "
|
|
28
|
-
* - "
|
|
26
|
+
* - "\@tag" matches → directive: "tag"
|
|
27
|
+
* - "\@myDirective" matches → directive: "myDirective"
|
|
28
|
+
* - "\@" does not match
|
|
29
29
|
* - "tag" does not match
|
|
30
30
|
*/
|
|
31
31
|
readonly DIRECTIVE_NAME: RegExp;
|
|
@@ -33,11 +33,11 @@ export declare const PATTERNS: {
|
|
|
33
33
|
* Matches group-by directive format with directive name, field, and optional fallback.
|
|
34
34
|
* Groups: (1) directive name, (2) field name, (3) optional fallback
|
|
35
35
|
*
|
|
36
|
-
* @pattern
|
|
36
|
+
* @pattern `^\@(\w+)\((\w+)(?:\|=(\w+))?\)$`
|
|
37
37
|
* @example
|
|
38
|
-
* - "
|
|
39
|
-
* - "
|
|
40
|
-
* - "
|
|
38
|
+
* - "\@tag(name)" matches → ["\@tag(name)", "tag", "name", undefined]
|
|
39
|
+
* - "\@category(type|=Other)" matches → ["\@category(type|=Other)", "category", "type", "Other"]
|
|
40
|
+
* - "\@tag()" does not match
|
|
41
41
|
* - "tag(name)" does not match
|
|
42
42
|
*/
|
|
43
43
|
readonly GROUP_BY_DIRECTIVE: RegExp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/const/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;IACnB;;;;;;;;;;OAUG
|
|
1
|
+
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/const/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;IACnB;;;;;;;;;;OAUG;aACH,cAAc;IAEd;;;;;;;;;;OAUG;aACH,kBAAkB;IAElB;;;;;;;;;OASG;aACH,aAAa;IAEb;;;;;;;;;OASG;aACH,eAAe;IAEf;;;;;;;;;OASG;aACH,uBAAuB;IAEvB;;;;;;;;;OASG;aACH,uBAAuB;IAEvB;;;;;;;;;;;;;OAaG;aACH,cAAc;CACN,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;;OAGG;aACH,aAAa,EAAE,eAAe;CACtB,CAAC"}
|
package/dist/const/patterns.js
CHANGED
|
@@ -22,13 +22,13 @@ exports.CONFIG_CONSTANTS = exports.PATTERNS = void 0;
|
|
|
22
22
|
exports.PATTERNS = {
|
|
23
23
|
/**
|
|
24
24
|
* Matches directive names with named capture groups.
|
|
25
|
-
* Captures the directive name after the
|
|
25
|
+
* Captures the directive name after the \@ symbol.
|
|
26
26
|
*
|
|
27
|
-
* @pattern
|
|
27
|
+
* @pattern `^\@(?<directive>\w+)$`
|
|
28
28
|
* @example
|
|
29
|
-
* - "
|
|
30
|
-
* - "
|
|
31
|
-
* - "
|
|
29
|
+
* - "\@tag" matches → directive: "tag"
|
|
30
|
+
* - "\@myDirective" matches → directive: "myDirective"
|
|
31
|
+
* - "\@" does not match
|
|
32
32
|
* - "tag" does not match
|
|
33
33
|
*/
|
|
34
34
|
DIRECTIVE_NAME: /^@(?<directive>\w+)$/, // NOSONAR: S5843
|
|
@@ -36,11 +36,11 @@ exports.PATTERNS = {
|
|
|
36
36
|
* Matches group-by directive format with directive name, field, and optional fallback.
|
|
37
37
|
* Groups: (1) directive name, (2) field name, (3) optional fallback
|
|
38
38
|
*
|
|
39
|
-
* @pattern
|
|
39
|
+
* @pattern `^\@(\w+)\((\w+)(?:\|=(\w+))?\)$`
|
|
40
40
|
* @example
|
|
41
|
-
* - "
|
|
42
|
-
* - "
|
|
43
|
-
* - "
|
|
41
|
+
* - "\@tag(name)" matches → ["\@tag(name)", "tag", "name", undefined]
|
|
42
|
+
* - "\@category(type|=Other)" matches → ["\@category(type|=Other)", "category", "type", "Other"]
|
|
43
|
+
* - "\@tag()" does not match
|
|
44
44
|
* - "tag(name)" does not match
|
|
45
45
|
*/
|
|
46
46
|
GROUP_BY_DIRECTIVE: /^@(\w+)\((\w+)(?:\|=(\w+))?\)$/, // NOSONAR: S5843
|
package/dist/diff.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACV,cAAc,EAEd,aAAa,EACb,KAAK,EACN,MAAM,yBAAyB,CAAC;AAIjC;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACV,cAAc,EAEd,aAAa,EACb,KAAK,EACN,MAAM,yBAAyB,CAAC;AAIjC;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,UAAU,WACb,aAAa,UACb,MAAM,cACF,KAAK,CAAC,cAAc,CAAC,eACrB,KAAK,CAAC,MAAM,CAAC,KACxB,OAAO,CAAC,OAAO,CAmBjB,CAAC"}
|
package/dist/diff.js
CHANGED
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.hasChanges = void 0;
|
|
37
4
|
const logger_1 = require("@graphql-markdown/logger");
|
|
@@ -91,7 +58,7 @@ const hasChanges = async (schema, tmpDir, diffMethod, diffModule = "@graphql-mar
|
|
|
91
58
|
return true;
|
|
92
59
|
}
|
|
93
60
|
try {
|
|
94
|
-
const { checkSchemaChanges, } = await
|
|
61
|
+
const { checkSchemaChanges, } = await import(diffModule);
|
|
95
62
|
return await checkSchemaChanges(schema, tmpDir, diffMethod);
|
|
96
63
|
}
|
|
97
64
|
catch {
|
|
@@ -37,7 +37,7 @@ import type { DirectiveName, Maybe } from "@graphql-markdown/types";
|
|
|
37
37
|
* // Result: ["@example", "@internal", "@auth"]
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
export declare const normalizeDirectiveNames: (...sources: Maybe<DirectiveName[]>[]) => DirectiveName[];
|
|
40
|
+
export declare const normalizeDirectiveNames: (...sources: (DirectiveName[] | Maybe<DirectiveName[]>)[]) => DirectiveName[];
|
|
41
41
|
/**
|
|
42
42
|
* Removes duplicate directive names from an array while preserving order.
|
|
43
43
|
*
|
|
@@ -75,5 +75,5 @@ export declare const uniqueDirectiveNames: (directives: DirectiveName[]) => Dire
|
|
|
75
75
|
* // Result: ["@example", "@internal", "@auth"]
|
|
76
76
|
* ```
|
|
77
77
|
*/
|
|
78
|
-
export declare const combineDirectiveNames: (...sources: Maybe<DirectiveName[]>[]) => DirectiveName[];
|
|
78
|
+
export declare const combineDirectiveNames: (...sources: (DirectiveName[] | Maybe<DirectiveName[]>)[]) => DirectiveName[];
|
|
79
79
|
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/directives/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/directives/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,uBAAuB,eACtB,CAAC,aAAa,EAAE,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,KACvD,aAAa,EAMf,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,eACnB,aAAa,EAAE,KAC1B,aAAa,EAEf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,qBAAqB,eACpB,CAAC,aAAa,EAAE,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,KACvD,aAAa,EAEf,CAAC"}
|
|
@@ -41,7 +41,9 @@ exports.combineDirectiveNames = exports.uniqueDirectiveNames = exports.normalize
|
|
|
41
41
|
*/
|
|
42
42
|
const normalizeDirectiveNames = (...sources) => {
|
|
43
43
|
return sources
|
|
44
|
-
.filter((s) =>
|
|
44
|
+
.filter((s) => {
|
|
45
|
+
return Array.isArray(s) && s.length > 0;
|
|
46
|
+
})
|
|
45
47
|
.flat();
|
|
46
48
|
};
|
|
47
49
|
exports.normalizeDirectiveNames = normalizeDirectiveNames;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/directives/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/directives/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,WAChB,OAAO,KACd,MAAM,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAMhE,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,WACT,OAAO,KACd,MAAM,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAMzD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,WAAY,OAAO,KAAG,MAAM,IAAI,MAE1D,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,WACjB,OAAO,KACd,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAElC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,SAAU,OAAO,KAAG,IAAI,IAAI,MAE9C,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,WACjB,OAAO,KACd,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAEjC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,WAAY,OAAO,KAAG,MAAM,IAAI,MAE1D,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,yBAAyB,WAC5B,OAAO,YACL,YAAY,GAAG,KAAK,KAC7B,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAMlC,CAAC"}
|
package/dist/event-emitter.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
|
-
import type { ICancellableEvent
|
|
2
|
+
import type { ICancellableEvent } from "@graphql-markdown/types";
|
|
3
3
|
/**
|
|
4
4
|
* Result object returned when emitting a cancellable event.
|
|
5
5
|
*
|
|
@@ -29,6 +29,8 @@ export interface EmitResult {
|
|
|
29
29
|
* @category Events
|
|
30
30
|
*/
|
|
31
31
|
declare class CancellableEventEmitter extends EventEmitter {
|
|
32
|
+
private static toError;
|
|
33
|
+
private static isDefaultPrevented;
|
|
32
34
|
/**
|
|
33
35
|
* Emit an event asynchronously with cancellable event support.
|
|
34
36
|
*
|
|
@@ -61,7 +63,10 @@ declare class CancellableEventEmitter extends EventEmitter {
|
|
|
61
63
|
* }
|
|
62
64
|
* ```
|
|
63
65
|
*/
|
|
64
|
-
emitAsync(eventName: string, event: ICancellableEvent
|
|
66
|
+
emitAsync(eventName: string, event: ICancellableEvent): Promise<EmitResult>;
|
|
67
|
+
private invokeListener;
|
|
68
|
+
private emitToListeners;
|
|
69
|
+
private runDefaultAction;
|
|
65
70
|
}
|
|
66
71
|
/**
|
|
67
72
|
* Get the singleton event emitter instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-emitter.d.ts","sourceRoot":"","sources":["../src/event-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"event-emitter.d.ts","sourceRoot":"","sources":["../src/event-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,MAAM,EAAE,KAAK,EAAE,CAAC;IAEhB;;;OAGG;IACH,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,cAAM,uBAAwB,SAAQ,YAAY;IAChD,OAAO,CAAC,MAAM,CAAC,OAAO;IAItB,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAMjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,SAAS,CACb,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,UAAU,CAAC,CAgBrB;YAEa,cAAc;YAOd,eAAe;YAsBf,gBAAgB;CAgB/B;AAQD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,SAAS,QAAO,uBAG5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,QAAO,IAK9B,CAAC"}
|
package/dist/event-emitter.js
CHANGED
|
@@ -14,6 +14,14 @@ const node_events_1 = require("node:events");
|
|
|
14
14
|
* @category Events
|
|
15
15
|
*/
|
|
16
16
|
class CancellableEventEmitter extends node_events_1.EventEmitter {
|
|
17
|
+
static toError(error) {
|
|
18
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
19
|
+
}
|
|
20
|
+
static isDefaultPrevented(event) {
|
|
21
|
+
return "defaultPrevented" in event
|
|
22
|
+
? !!event.defaultPrevented
|
|
23
|
+
: false;
|
|
24
|
+
}
|
|
17
25
|
/**
|
|
18
26
|
* Emit an event asynchronously with cancellable event support.
|
|
19
27
|
*
|
|
@@ -52,39 +60,40 @@ class CancellableEventEmitter extends node_events_1.EventEmitter {
|
|
|
52
60
|
const listeners = this.listeners(eventName);
|
|
53
61
|
// Check if event is a full cancellable event (has propagationStopped property)
|
|
54
62
|
const isCancellable = "propagationStopped" in event;
|
|
55
|
-
|
|
63
|
+
await this.emitToListeners(listeners, event, errors, isCancellable);
|
|
64
|
+
await this.runDefaultAction(event, errors);
|
|
65
|
+
return {
|
|
66
|
+
errors,
|
|
67
|
+
defaultPrevented: CancellableEventEmitter.isDefaultPrevented(event),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async invokeListener(listener, event) {
|
|
71
|
+
await Promise.resolve(listener(event));
|
|
72
|
+
}
|
|
73
|
+
async emitToListeners(listeners, event, errors, isCancellable) {
|
|
56
74
|
for (const listener of listeners) {
|
|
57
75
|
try {
|
|
58
|
-
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
60
|
-
await listener(event);
|
|
61
|
-
// Check if handler stopped propagation to remaining handlers
|
|
76
|
+
await this.invokeListener(listener, event);
|
|
62
77
|
if (isCancellable &&
|
|
63
78
|
event.propagationStopped) {
|
|
64
|
-
break;
|
|
79
|
+
break;
|
|
65
80
|
}
|
|
66
81
|
}
|
|
67
82
|
catch (error) {
|
|
68
|
-
|
|
69
|
-
errors.push(error instanceof Error ? error : new Error(String(error)));
|
|
83
|
+
errors.push(CancellableEventEmitter.toError(error));
|
|
70
84
|
}
|
|
71
85
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
}
|
|
87
|
+
async runDefaultAction(event, errors) {
|
|
88
|
+
if (!("runDefaultAction" in event)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
await event.runDefaultAction();
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
errors.push(CancellableEventEmitter.toError(error));
|
|
82
96
|
}
|
|
83
|
-
// Check defaultPrevented - simple events may have this property
|
|
84
|
-
const defaultPrevented = "defaultPrevented" in event
|
|
85
|
-
? !!event.defaultPrevented
|
|
86
|
-
: false;
|
|
87
|
-
return { errors, defaultPrevented };
|
|
88
97
|
}
|
|
89
98
|
}
|
|
90
99
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-handlers.d.ts","sourceRoot":"","sources":["../src/event-handlers.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"event-handlers.d.ts","sourceRoot":"","sources":["../src/event-handlers.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,wBAAwB,cAAe,OAAO,KAAG,IAwC7D,CAAC"}
|
package/dist/event-map.d.ts
CHANGED
|
@@ -18,9 +18,11 @@ export declare const EVENT_CALLBACK_MAP: {
|
|
|
18
18
|
readonly "render:afterRenderTypeEntities": "afterRenderTypeEntitiesHook";
|
|
19
19
|
readonly "render:beforeGenerateIndexMetafile": "beforeGenerateIndexMetafileHook";
|
|
20
20
|
readonly "render:afterGenerateIndexMetafile": "afterGenerateIndexMetafileHook";
|
|
21
|
+
readonly "render:afterRenderFiles": "afterRenderFilesHook";
|
|
21
22
|
readonly "print:beforePrintCode": "beforePrintCodeHook";
|
|
22
23
|
readonly "print:afterPrintCode": "afterPrintCodeHook";
|
|
23
24
|
readonly "print:beforePrintType": "beforePrintTypeHook";
|
|
24
25
|
readonly "print:afterPrintType": "afterPrintTypeHook";
|
|
26
|
+
readonly "print:beforeComposePageType": "beforeComposePageTypeHook";
|
|
25
27
|
};
|
|
26
28
|
//# sourceMappingURL=event-map.d.ts.map
|
package/dist/event-map.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-map.d.ts","sourceRoot":"","sources":["../src/event-map.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event-map.d.ts","sourceRoot":"","sources":["../src/event-map.ts"],"names":[],"mappings":"AAiBA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;kCACD,sBAAsB;iCACvB,qBAAqB;iCACrB,qBAAqB;gCACtB,oBAAoB;6CACP,2BAA2B;4CAC5B,0BAA0B;4CAC1B,0BAA0B;2CAC3B,yBAAyB;gDACpB,8BAA8B;+CAC/B,6BAA6B;mDAEpE,iCAAiC;kDAEjC,gCAAgC;wCACA,sBAAsB;sCACnB,qBAAqB;qCACtB,oBAAoB;sCACnB,qBAAqB;qCACtB,oBAAoB;4CACZ,2BAA2B;CAC/D,CAAC"}
|
package/dist/event-map.js
CHANGED
|
@@ -15,6 +15,7 @@ const render_root_types_events_1 = require("./events/render-root-types-events");
|
|
|
15
15
|
const render_homepage_events_1 = require("./events/render-homepage-events");
|
|
16
16
|
const render_type_entities_events_1 = require("./events/render-type-entities-events");
|
|
17
17
|
const generate_index_metafile_events_1 = require("./events/generate-index-metafile-events");
|
|
18
|
+
const render_files_events_1 = require("./events/render-files-events");
|
|
18
19
|
const print_type_events_1 = require("./events/print-type-events");
|
|
19
20
|
/**
|
|
20
21
|
* Event callback mapping configuration.
|
|
@@ -36,8 +37,10 @@ exports.EVENT_CALLBACK_MAP = {
|
|
|
36
37
|
[render_type_entities_events_1.RenderTypeEntitiesEvents.AFTER_RENDER]: "afterRenderTypeEntitiesHook",
|
|
37
38
|
[generate_index_metafile_events_1.GenerateIndexMetafileEvents.BEFORE_GENERATE]: "beforeGenerateIndexMetafileHook",
|
|
38
39
|
[generate_index_metafile_events_1.GenerateIndexMetafileEvents.AFTER_GENERATE]: "afterGenerateIndexMetafileHook",
|
|
40
|
+
[render_files_events_1.RenderFilesEvents.AFTER_RENDER]: "afterRenderFilesHook",
|
|
39
41
|
[print_type_events_1.PrintTypeEvents.BEFORE_PRINT_CODE]: "beforePrintCodeHook",
|
|
40
42
|
[print_type_events_1.PrintTypeEvents.AFTER_PRINT_CODE]: "afterPrintCodeHook",
|
|
41
43
|
[print_type_events_1.PrintTypeEvents.BEFORE_PRINT_TYPE]: "beforePrintTypeHook",
|
|
42
44
|
[print_type_events_1.PrintTypeEvents.AFTER_PRINT_TYPE]: "afterPrintTypeHook",
|
|
45
|
+
[print_type_events_1.PrintTypeEvents.BEFORE_COMPOSE_PAGE_TYPE]: "beforeComposePageTypeHook",
|
|
43
46
|
};
|