docula 0.3.0 → 0.3.2

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.
Files changed (94) hide show
  1. package/README.md +2 -3
  2. package/package.json +15 -14
  3. package/dist/config.d.ts +0 -21
  4. package/dist/config.d.ts.map +0 -1
  5. package/dist/config.js +0 -78
  6. package/dist/config.js.map +0 -1
  7. package/dist/docula-plugin.d.ts +0 -9
  8. package/dist/docula-plugin.d.ts.map +0 -1
  9. package/dist/docula-plugin.js +0 -2
  10. package/dist/docula-plugin.js.map +0 -1
  11. package/dist/docula.d.ts +0 -22
  12. package/dist/docula.d.ts.map +0 -1
  13. package/dist/docula.js +0 -188
  14. package/dist/docula.js.map +0 -1
  15. package/dist/eleventy/filters.d.ts +0 -2
  16. package/dist/eleventy/filters.d.ts.map +0 -1
  17. package/dist/eleventy/filters.js +0 -10
  18. package/dist/eleventy/filters.js.map +0 -1
  19. package/dist/eleventy/global-data.d.ts +0 -3
  20. package/dist/eleventy/global-data.d.ts.map +0 -1
  21. package/dist/eleventy/global-data.js +0 -2
  22. package/dist/eleventy/global-data.js.map +0 -1
  23. package/dist/eleventy/shortcodes.d.ts +0 -4
  24. package/dist/eleventy/shortcodes.d.ts.map +0 -1
  25. package/dist/eleventy/shortcodes.js +0 -18
  26. package/dist/eleventy/shortcodes.js.map +0 -1
  27. package/dist/eleventy.d.ts +0 -24
  28. package/dist/eleventy.d.ts.map +0 -1
  29. package/dist/eleventy.js +0 -80
  30. package/dist/eleventy.js.map +0 -1
  31. package/dist/index.d.ts +0 -9
  32. package/dist/index.d.ts.map +0 -1
  33. package/dist/index.js +0 -53
  34. package/dist/index.js.map +0 -1
  35. package/dist/logger.d.ts +0 -4
  36. package/dist/logger.d.ts.map +0 -1
  37. package/dist/logger.js +0 -20
  38. package/dist/logger.js.map +0 -1
  39. package/dist/plugins/algolia.d.ts +0 -21
  40. package/dist/plugins/algolia.d.ts.map +0 -1
  41. package/dist/plugins/algolia.js +0 -54
  42. package/dist/plugins/algolia.js.map +0 -1
  43. package/dist/plugins/github.d.ts +0 -16
  44. package/dist/plugins/github.d.ts.map +0 -1
  45. package/dist/plugins/github.js +0 -69
  46. package/dist/plugins/github.js.map +0 -1
  47. package/dist/plugins/index.d.ts +0 -18
  48. package/dist/plugins/index.d.ts.map +0 -1
  49. package/dist/plugins/index.js +0 -16
  50. package/dist/plugins/index.js.map +0 -1
  51. package/dist/plugins/npm.d.ts +0 -14
  52. package/dist/plugins/npm.d.ts.map +0 -1
  53. package/dist/plugins/npm.js +0 -37
  54. package/dist/plugins/npm.js.map +0 -1
  55. package/dist/plugins/pagefind.d.ts +0 -10
  56. package/dist/plugins/pagefind.d.ts.map +0 -1
  57. package/dist/plugins/pagefind.js +0 -23
  58. package/dist/plugins/pagefind.js.map +0 -1
  59. package/dist/plugins/robots.d.ts +0 -14
  60. package/dist/plugins/robots.d.ts.map +0 -1
  61. package/dist/plugins/robots.js +0 -35
  62. package/dist/plugins/robots.js.map +0 -1
  63. package/dist/plugins/sitemap.d.ts +0 -11
  64. package/dist/plugins/sitemap.d.ts.map +0 -1
  65. package/dist/plugins/sitemap.js +0 -27
  66. package/dist/plugins/sitemap.js.map +0 -1
  67. package/dist/schemas.d.ts +0 -21
  68. package/dist/schemas.d.ts.map +0 -1
  69. package/dist/schemas.js +0 -25
  70. package/dist/schemas.js.map +0 -1
  71. package/dist/tools/__mocks__/inquirer-prompt.d.ts +0 -20
  72. package/dist/tools/__mocks__/inquirer-prompt.d.ts.map +0 -1
  73. package/dist/tools/__mocks__/inquirer-prompt.js +0 -19
  74. package/dist/tools/__mocks__/inquirer-prompt.js.map +0 -1
  75. package/dist/tools/__mocks__/path.d.ts +0 -4
  76. package/dist/tools/__mocks__/path.d.ts.map +0 -1
  77. package/dist/tools/__mocks__/path.js +0 -5
  78. package/dist/tools/__mocks__/path.js.map +0 -1
  79. package/dist/tools/inquirer-prompt.d.ts +0 -11
  80. package/dist/tools/inquirer-prompt.d.ts.map +0 -1
  81. package/dist/tools/inquirer-prompt.js +0 -139
  82. package/dist/tools/inquirer-prompt.js.map +0 -1
  83. package/dist/tools/path.d.ts +0 -3
  84. package/dist/tools/path.d.ts.map +0 -1
  85. package/dist/tools/path.js +0 -5
  86. package/dist/tools/path.js.map +0 -1
  87. package/dist/tools/tools.d.ts +0 -3
  88. package/dist/tools/tools.d.ts.map +0 -1
  89. package/dist/tools/tools.js +0 -10
  90. package/dist/tools/tools.js.map +0 -1
  91. package/dist/types/config.d.ts +0 -8
  92. package/dist/types/config.d.ts.map +0 -1
  93. package/dist/types/config.js +0 -2
  94. package/dist/types/config.js.map +0 -1
package/dist/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import { type OptionValues } from 'commander';
3
- export type CommanderOptions = {
4
- opts: () => OptionValues;
5
- };
6
- export declare class Executable {
7
- parseCLI(process: NodeJS.Process): Promise<void>;
8
- }
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAgB,KAAK,YAAY,EAAC,MAAM,WAAW,CAAC;AAK3D,MAAM,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,MAAM,YAAY,CAAC;CACzB,CAAC;AAEF,qBAAa,UAAU;IAEhB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO;CA+CtC"}
package/dist/index.js DELETED
@@ -1,53 +0,0 @@
1
- import { createCommand } from 'commander';
2
- import { Docula } from './docula.js';
3
- import { reportError } from './tools/tools.js';
4
- import logger from './logger.js';
5
- export class Executable {
6
- // eslint-disable-next-line @typescript-eslint/naming-convention
7
- async parseCLI(process) {
8
- const program = createCommand();
9
- program.storeOptionsAsProperties(true);
10
- program.command('build', { isDefault: true })
11
- .description('Build the site')
12
- .option('-c, --config <config>', 'Path of where the config file is located')
13
- .action(async (options) => {
14
- try {
15
- logger.info('Building your documentation...');
16
- const docula = new Docula(options);
17
- await docula.build();
18
- logger.info('Site was built successfully!');
19
- }
20
- catch (error) {
21
- reportError(error);
22
- }
23
- });
24
- program.command('init')
25
- .description('Initialize the site')
26
- .action(async (options) => {
27
- try {
28
- logger.info('Initializing Docula...');
29
- const docula = new Docula(options);
30
- await docula.init();
31
- }
32
- catch (error) {
33
- reportError(error);
34
- }
35
- });
36
- program.command('serve')
37
- .description('build and serve the site')
38
- .action(async (options) => {
39
- try {
40
- logger.info('Building your documentation...');
41
- const docula = new Docula(options);
42
- await docula.build();
43
- logger.info('Site was built successfully!');
44
- await docula.serve();
45
- }
46
- catch (error) {
47
- reportError(error);
48
- }
49
- });
50
- program.parse(process.argv);
51
- }
52
- }
53
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAoB,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,MAAM,MAAM,aAAa,CAAC;AAMjC,MAAM,OAAO,UAAU;IACtB,gEAAgE;IAChE,KAAK,CAAC,QAAQ,CAAC,OAAuB;QACrC,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;QAEhC,OAAO,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAEvC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC;aACzC,WAAW,CAAC,gBAAgB,CAAC;aAC7B,MAAM,CAAC,uBAAuB,EAAE,0CAA0C,CAAC;aAC3E,MAAM,CAAC,KAAK,EAAE,OAAyB,EAAE,EAAE;YAC3C,IAAI;gBACH,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;gBAC9C,MAAM,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,0 @@
1
- import winston from 'winston';
2
- declare const logger: winston.Logger;
3
- export default logger;
4
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAU9B,QAAA,MAAM,MAAM,gBAaV,CAAC;AAEH,eAAe,MAAM,CAAC"}
package/dist/logger.js DELETED
@@ -1,20 +0,0 @@
1
- import winston from 'winston';
2
- const logFormat = winston.format.printf(({ level, message }) => {
3
- if (level === 'error') {
4
- return `[Docula] Error: ${message}`;
5
- }
6
- return `[Docula] ${message}`;
7
- });
8
- const logger = winston.createLogger({
9
- level: 'info',
10
- format: winston.format.json(),
11
- transports: [
12
- new winston.transports.Console({
13
- format: winston.format.combine(logFormat, winston.format.colorize({
14
- all: true,
15
- })),
16
- }),
17
- ],
18
- });
19
- export default logger;
20
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAC,KAAK,EAAE,OAAO,EAAyB,EAAE,EAAE;IACpF,IAAI,KAAK,KAAK,OAAO,EAAE;QACtB,OAAO,mBAAmB,OAAO,EAAE,CAAC;KACpC;IAED,OAAO,YAAY,OAAO,EAAE,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IACnC,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE;IAC7B,UAAU,EAAE;QACX,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;YAC9B,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAC7B,SAAS,EACT,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACvB,GAAG,EAAE,IAAI;aACT,CAAC,CACF;SACD,CAAC;KACF;CACD,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -1,21 +0,0 @@
1
- import { type SearchClient, type SearchIndex } from 'algoliasearch';
2
- import type { Config } from '../config.js';
3
- import type { DoculaPlugin, Options, Schema, Runtime } from '../docula-plugin.js';
4
- export type AlgoliaConfig = {
5
- apiKey: string;
6
- appId: string;
7
- indexName: string;
8
- };
9
- type SearchOptions = {
10
- index?: SearchIndex;
11
- } & Options;
12
- export declare class AlgoliaPlugin implements DoculaPlugin {
13
- static schema: Schema;
14
- readonly options: SearchOptions;
15
- runtime: Runtime;
16
- readonly client: SearchClient;
17
- constructor(config: Config);
18
- execute(): Promise<void>;
19
- }
20
- export {};
21
- //# sourceMappingURL=algolia.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"algolia.d.ts","sourceRoot":"","sources":["../../src/plugins/algolia.ts"],"names":[],"mappings":"AACA,OAAsB,EAAC,KAAK,YAAY,EAAE,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAEjF,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAEhF,MAAM,MAAM,aAAa,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,aAAa,GAAG;IACpB,KAAK,CAAC,EAAE,WAAW,CAAC;CACpB,GAAG,OAAO,CAAC;AAEZ,qBAAa,aAAc,YAAW,YAAY;IACjD,MAAM,CAAC,MAAM,EAAE,MAAM,CAQnB;IAEF,QAAQ,CAAC,OAAO,EAAE,aAAa,CAK7B;IAEF,OAAO,EAAE,OAAO,CAAW;IAC3B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;gBAElB,MAAM,EAAE,MAAM;IAWpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAqB9B"}
@@ -1,54 +0,0 @@
1
- import process from 'node:process';
2
- import algoliasearch from 'algoliasearch';
3
- import fs from 'fs-extra';
4
- class AlgoliaPlugin {
5
- constructor(config) {
6
- this.options = {
7
- apiKey: '',
8
- appId: '',
9
- indexName: '',
10
- outputPath: '',
11
- };
12
- this.runtime = 'after';
13
- const { appId, apiKey, indexName } = config.pluginConfig.algolia;
14
- this.options.outputPath = config.outputPath;
15
- this.options.appId = appId;
16
- this.options.apiKey = apiKey;
17
- this.options.indexName = indexName;
18
- // @ts-expect-error - algoliasearch is not callable
19
- this.client = algoliasearch(this.options.appId, this.options.apiKey);
20
- this.options.index = this.client.initIndex(this.options.indexName);
21
- }
22
- async execute() {
23
- let jsonContent = [];
24
- const jsonPath = `${process.cwd()}/${this.options.outputPath}/algolia.json`;
25
- if (fs.existsSync(jsonPath)) {
26
- const data = fs.readFileSync(jsonPath, 'utf8');
27
- const content = JSON.parse(data);
28
- jsonContent = content.filter(item => item.description.length);
29
- }
30
- try {
31
- // @ts-expect-error - clearObjects
32
- await this.options.index.clearObjects();
33
- // @ts-expect-error - saveObjects
34
- await this.options.index.saveObjects(jsonContent, {
35
- // eslint-disable-next-line @typescript-eslint/naming-convention
36
- autoGenerateObjectIDIfNotExist: true,
37
- });
38
- }
39
- catch (error) {
40
- throw new Error(`Error while indexing to Algolia: ${error.message}`);
41
- }
42
- }
43
- }
44
- AlgoliaPlugin.schema = {
45
- type: 'object',
46
- required: ['apiKey', 'appId', 'indexName'],
47
- properties: {
48
- apiKey: { type: 'string' },
49
- appId: { type: 'string' },
50
- indexName: { type: 'string' },
51
- },
52
- };
53
- export { AlgoliaPlugin };
54
- //# sourceMappingURL=algolia.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"algolia.js","sourceRoot":"","sources":["../../src/plugins/algolia.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OAAO,GAAkC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAChE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;SAC9D;QAED,IAAI;YACH,kCAAkC;YAClC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;YACxC,iCAAiC;YACjC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE;gBACjD,gEAAgE;gBAChE,8BAA8B,EAAE,IAAI;aACpC,CAAC,CAAC;SACH;QAAC,OAAO,KAAc,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,oCAAqC,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;SAChF;IACF,CAAC;;AAnDM,oBAAM,GAAW;IACvB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC;IAC1C,UAAU,EAAE;QACX,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACxB,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACvB,SAAS,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;KAC3B;CACD,AARY,CAQX;SATU,aAAa"}
@@ -1,16 +0,0 @@
1
- import type { DoculaPlugin, Options, Schema, Runtime } from '../docula-plugin.js';
2
- import type { Config } from '../config.js';
3
- export type GithubConfig = {
4
- repo: string;
5
- author: string;
6
- };
7
- export declare class GithubPlugin implements DoculaPlugin {
8
- static schema: Schema;
9
- readonly options: Options;
10
- runtime: Runtime;
11
- constructor(config: Config);
12
- execute(): Promise<void>;
13
- getReleases(): Promise<any>;
14
- getContributors(): Promise<any>;
15
- }
16
- //# sourceMappingURL=github.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/plugins/github.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAAa,YAAa,YAAW,YAAY;IAChD,MAAM,CAAC,MAAM,EAAE,MAAM,CAOnB;IAEF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAOvB;IAEF,OAAO,EAAE,OAAO,CAAY;gBAEhB,MAAM,EAAE,MAAM;IAOpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAaxB,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;IAe3B,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC;CAcrC"}
@@ -1,69 +0,0 @@
1
- import fs from 'fs-extra';
2
- import axios from 'axios';
3
- class GithubPlugin {
4
- constructor(config) {
5
- this.options = {
6
- api: 'https://api.github.com',
7
- dataPath: '_data',
8
- author: '',
9
- repo: '',
10
- outputFile: 'github.json',
11
- sitePath: '',
12
- };
13
- this.runtime = 'before';
14
- this.options.sitePath = config.originPath;
15
- const { author, repo } = config.pluginConfig.github;
16
- this.options.author = author;
17
- this.options.repo = repo;
18
- }
19
- async execute() {
20
- const data = {
21
- releases: {},
22
- contributors: {},
23
- };
24
- data.releases = await this.getReleases();
25
- data.contributors = await this.getContributors();
26
- const path = `${this.options.sitePath}/${this.options.dataPath}`;
27
- const filePath = `${path}/${this.options.outputFile}`;
28
- await fs.ensureDir(path);
29
- await fs.writeFile(filePath, JSON.stringify(data, null, 2));
30
- }
31
- async getReleases() {
32
- const url = `${this.options.api}/repos/${this.options.author}/${this.options.repo}/releases`;
33
- try {
34
- const result = await axios.get(url);
35
- return result.data;
36
- }
37
- catch (error) {
38
- const typedError = error;
39
- if (typedError.response?.status === 404) {
40
- throw new Error(`Repository ${this.options.author}/${this.options.repo} not found.`);
41
- }
42
- throw error;
43
- }
44
- }
45
- async getContributors() {
46
- const url = `${this.options.api}/repos/${this.options.author}/${this.options.repo}/contributors`;
47
- try {
48
- const result = await axios.get(url);
49
- return result.data;
50
- }
51
- catch (error) {
52
- const typedError = error;
53
- if (typedError.response?.status === 404) {
54
- throw new Error(`Repository ${this.options.author}/${this.options.repo} not found.`);
55
- }
56
- throw error;
57
- }
58
- }
59
- }
60
- GithubPlugin.schema = {
61
- type: 'object',
62
- required: ['repo', 'author'],
63
- properties: {
64
- repo: { type: 'string' },
65
- author: { type: 'string' },
66
- },
67
- };
68
- export { GithubPlugin };
69
- //# sourceMappingURL=github.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/plugins/github.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAa,YAAY;IAqBxB,YAAY,MAAc;QAXjB,YAAO,GAAY;YAC3B,GAAG,EAAE,wBAAwB;YAC7B,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE;YACR,UAAU,EAAE,aAAa;YACzB,QAAQ,EAAE,EAAE;SACZ,CAAC;QAEF,YAAO,GAAY,QAAQ,CAAC;QAG3B,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC;QAC1C,MAAM,EAAC,MAAM,EAAE,IAAI,EAAC,GAAG,MAAM,CAAC,YAAY,CAAC,MAAsB,CAAC;QAClE,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;QAC7B,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,MAAM,IAAI,GAAG;YACZ,QAAQ,EAAE,EAAE;YACZ,YAAY,EAAE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,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,eAAe,CAAC;QACjG,IAAI;YACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpC,OAAO,MAAM,CAAC,IAAI,CAAC;SACnB;QAAC,OAAO,KAAc,EAAE;YACxB,MAAM,UAAU,GAAG,KAAqC,CAAC;YACzD,IAAI,UAAU,CAAC,QAAQ,EAAE,MAAM,KAAK,GAAG,EAAE;gBACxC,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,CAAC;aACrF;YAED,MAAM,KAAK,CAAC;SACZ;IACF,CAAC;;AApEM,mBAAM,GAAW;IACvB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC5B,UAAU,EAAE;QACX,IAAI,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACtB,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;KACxB;CACD,AAPY,CAOX;SARU,YAAY"}
@@ -1,18 +0,0 @@
1
- import { type GithubConfig, GithubPlugin } from './github.js';
2
- import { type NpmConfig, NpmPlugin } from './npm.js';
3
- import { type RobotsConfig, RobotsPlugin } from './robots.js';
4
- import { SitemapPlugin } from './sitemap.js';
5
- import { PagefindPlugin } from './pagefind.js';
6
- import { type AlgoliaConfig, AlgoliaPlugin } from './algolia.js';
7
- declare const plugins: {
8
- github: typeof GithubPlugin;
9
- npm: typeof NpmPlugin;
10
- robots: typeof RobotsPlugin;
11
- sitemap: typeof SitemapPlugin;
12
- pagefind: typeof PagefindPlugin;
13
- algolia: typeof AlgoliaPlugin;
14
- };
15
- export type PluginConfig = GithubConfig | NpmConfig | RobotsConfig | AlgoliaConfig;
16
- export type PluginInstance = GithubPlugin | NpmPlugin | RobotsPlugin | SitemapPlugin | PagefindPlugin | AlgoliaPlugin;
17
- export default plugins;
18
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,YAAY,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAC,KAAK,SAAS,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AACnD,OAAO,EAAC,KAAK,YAAY,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,KAAK,aAAa,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAE/D,QAAA,MAAM,OAAO;;;;;;;CAOZ,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,aAAa,CAAC;AAEnF,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,aAAa,GAAG,cAAc,GAAG,aAAa,CAAC;AAEtH,eAAe,OAAO,CAAC"}
@@ -1,16 +0,0 @@
1
- import { GithubPlugin } from './github.js';
2
- import { NpmPlugin } from './npm.js';
3
- import { RobotsPlugin } from './robots.js';
4
- import { SitemapPlugin } from './sitemap.js';
5
- import { PagefindPlugin } from './pagefind.js';
6
- import { AlgoliaPlugin } from './algolia.js';
7
- const plugins = {
8
- github: GithubPlugin,
9
- npm: NpmPlugin,
10
- robots: RobotsPlugin,
11
- sitemap: SitemapPlugin,
12
- pagefind: PagefindPlugin,
13
- algolia: AlgoliaPlugin,
14
- };
15
- export default plugins;
16
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAC,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAiB,SAAS,EAAC,MAAM,UAAU,CAAC;AACnD,OAAO,EAAoB,YAAY,EAAC,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAqB,aAAa,EAAC,MAAM,cAAc,CAAC;AAE/D,MAAM,OAAO,GAAG;IACf,MAAM,EAAE,YAAY;IACpB,GAAG,EAAE,SAAS;IACd,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,cAAc;IACxB,OAAO,EAAE,aAAa;CACtB,CAAC;AAMF,eAAe,OAAO,CAAC"}
@@ -1,14 +0,0 @@
1
- import type { DoculaPlugin, Options, Schema, Runtime } from '../docula-plugin.js';
2
- import type { Config } from '../config.js';
3
- export type NpmConfig = {
4
- moduleName: string;
5
- };
6
- export declare class NpmPlugin implements DoculaPlugin {
7
- static schema: Schema;
8
- readonly options: Options;
9
- runtime: Runtime;
10
- constructor(config: Config);
11
- execute(): Promise<void>;
12
- getMonthlyDownloads(): Promise<any>;
13
- }
14
- //# sourceMappingURL=npm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"npm.d.ts","sourceRoot":"","sources":["../../src/plugins/npm.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEzC,MAAM,MAAM,SAAS,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,qBAAa,SAAU,YAAW,YAAY;IAC7C,MAAM,CAAC,MAAM,EAAE,MAAM,CAMnB;IAEF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAKvB;IAEF,OAAO,EAAE,OAAO,CAAY;gBAEhB,MAAM,EAAE,MAAM;IAMpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,mBAAmB,IAAI,OAAO,CAAC,GAAG,CAAC;CAKzC"}
@@ -1,37 +0,0 @@
1
- import axios from 'axios';
2
- import fs from 'fs-extra';
3
- class NpmPlugin {
4
- constructor(config) {
5
- this.options = {
6
- dataPath: '_data',
7
- moduleName: '',
8
- outputFile: 'npm.json',
9
- sitePath: '',
10
- };
11
- this.runtime = 'before';
12
- this.options.sitePath = config.originPath;
13
- const { moduleName } = config.pluginConfig.npm;
14
- this.options.moduleName = moduleName;
15
- }
16
- async execute() {
17
- const data = await this.getMonthlyDownloads();
18
- const path = `${this.options.sitePath}/${this.options.dataPath}`;
19
- const filePath = `${this.options.sitePath}/${this.options.dataPath}/${this.options.outputFile}`;
20
- await fs.ensureDir(path);
21
- await fs.writeFile(filePath, JSON.stringify(data, null, 2));
22
- }
23
- async getMonthlyDownloads() {
24
- const url = `https://api.npmjs.org/downloads/point/last-month/${this.options.moduleName}`;
25
- const result = await axios.get(url);
26
- return result.data;
27
- }
28
- }
29
- NpmPlugin.schema = {
30
- type: 'object',
31
- required: ['moduleName'],
32
- properties: {
33
- moduleName: { type: 'string' },
34
- },
35
- };
36
- export { NpmPlugin };
37
- //# sourceMappingURL=npm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"npm.js","sourceRoot":"","sources":["../../src/plugins/npm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,UAAU,CAAC;AAQ1B,MAAa,SAAS;IAkBrB,YAAY,MAAc;QATjB,YAAO,GAAY;YAC3B,QAAQ,EAAE,OAAO;YACjB,UAAU,EAAE,EAAE;YACd,UAAU,EAAE,UAAU;YACtB,QAAQ,EAAE,EAAE;SACZ,CAAC;QAEF,YAAO,GAAY,QAAQ,CAAC;QAG3B,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC;QAC1C,MAAM,EAAC,UAAU,EAAC,GAAG,MAAM,CAAC,YAAY,CAAC,GAAgB,CAAC;QAC1D,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC9C,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACjE,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAChG,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACzB,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,mBAAmB;QACxB,MAAM,GAAG,GAAG,oDAAoD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAC1F,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpC,OAAO,MAAM,CAAC,IAAI,CAAC;IACpB,CAAC;;AAnCM,gBAAM,GAAW;IACvB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,YAAY,CAAC;IACxB,UAAU,EAAE;QACX,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;KAC5B;CACD,AANY,CAMX;SAPU,SAAS"}
@@ -1,10 +0,0 @@
1
- import type { DoculaPlugin, Options, Schema, Runtime } from '../docula-plugin.js';
2
- import type { Config } from '../config.js';
3
- export declare class PagefindPlugin implements DoculaPlugin {
4
- static schema: Schema;
5
- readonly options: Options;
6
- runtime: Runtime;
7
- constructor(config: Config);
8
- execute(): Promise<void>;
9
- }
10
- //# sourceMappingURL=pagefind.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pagefind.d.ts","sourceRoot":"","sources":["../../src/plugins/pagefind.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEzC,qBAAa,cAAe,YAAW,YAAY;IAClD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;IAE3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAEvB;IAEF,OAAO,EAAE,OAAO,CAAW;gBAEf,MAAM,EAAE,MAAM;IAIpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAW9B"}
@@ -1,23 +0,0 @@
1
- import { exec } from 'node:child_process';
2
- class PagefindPlugin {
3
- constructor(config) {
4
- this.options = {
5
- outputPath: '',
6
- };
7
- this.runtime = 'after';
8
- this.options.outputPath = config.outputPath;
9
- }
10
- async execute() {
11
- await new Promise((resolve, reject) => {
12
- exec(`npx pagefind --source ${this.options.outputPath}`, (error, stdout) => {
13
- if (error) {
14
- reject(error);
15
- }
16
- resolve(stdout);
17
- });
18
- });
19
- }
20
- }
21
- PagefindPlugin.schema = {};
22
- export { PagefindPlugin };
23
- //# sourceMappingURL=pagefind.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pagefind.js","sourceRoot":"","sources":["../../src/plugins/pagefind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AAIxC,MAAa,cAAc;IAS1B,YAAY,MAAc;QANjB,YAAO,GAAY;YAC3B,UAAU,EAAE,EAAE;SACd,CAAC;QAEF,YAAO,GAAY,OAAO,CAAC;QAG1B,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,yBAAyB,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,KAAU,EAAE,MAAW,EAAE,EAAE;gBACpF,IAAI,KAAK,EAAE;oBACV,MAAM,CAAC,KAAK,CAAC,CAAC;iBACd;gBAED,OAAO,CAAC,MAAM,CAAC,CAAC;YACjB,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;;AAtBM,qBAAM,GAAW,EAAE,AAAb,CAAc;SADf,cAAc"}
@@ -1,14 +0,0 @@
1
- import type { DoculaPlugin, Options, Runtime, Schema } from '../docula-plugin.js';
2
- import type { Config } from '../config.js';
3
- export type RobotsConfig = {
4
- allowedUrl: string;
5
- disallowedUrl: string;
6
- };
7
- export declare class RobotsPlugin implements DoculaPlugin {
8
- static schema: Schema;
9
- readonly options: Options;
10
- runtime: Runtime;
11
- constructor(config: Config);
12
- execute(): Promise<void>;
13
- }
14
- //# sourceMappingURL=robots.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"robots.d.ts","sourceRoot":"","sources":["../../src/plugins/robots.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,qBAAa,YAAa,YAAW,YAAY;IAChD,MAAM,CAAC,MAAM,EAAE,MAAM,CAMnB;IAEF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAGvB;IAEF,OAAO,EAAE,OAAO,CAAW;gBAEf,MAAM,EAAE,MAAM;IAYpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAS9B"}
@@ -1,35 +0,0 @@
1
- import fs from 'fs-extra';
2
- class RobotsPlugin {
3
- constructor(config) {
4
- this.options = {
5
- sitemapPath: 'sitemap.xml',
6
- outputFile: 'robots.txt',
7
- };
8
- this.runtime = 'after';
9
- this.options.outputPath = config.outputPath;
10
- const { allowedUrl, disallowedUrl } = config.pluginConfig.robots || {};
11
- if (allowedUrl) {
12
- this.options.allowedUrl = allowedUrl;
13
- }
14
- if (disallowedUrl) {
15
- this.options.disallowedUrl = disallowedUrl;
16
- }
17
- }
18
- async execute() {
19
- const isAllowed = this.options.allowedUrl ? `Allow: ${this.options.allowedUrl}` : '';
20
- const isDisallowed = this.options.disallowedUrl ? `Disallow: ${this.options.disallowedUrl}` : '';
21
- const data = `User-agent: * \n${isAllowed} \n${isDisallowed} \nSitemap: ${this.options.sitemapPath}`;
22
- const filePath = `${this.options.outputPath}/${this.options.outputFile}`;
23
- await fs.ensureDir(this.options.outputPath);
24
- await fs.writeFile(filePath, data);
25
- }
26
- }
27
- RobotsPlugin.schema = {
28
- type: 'object',
29
- properties: {
30
- allowedUrl: { type: 'string' },
31
- disallowedUrl: { type: 'string' },
32
- },
33
- };
34
- export { RobotsPlugin };
35
- //# sourceMappingURL=robots.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"robots.js","sourceRoot":"","sources":["../../src/plugins/robots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAS1B,MAAa,YAAY;IAgBxB,YAAY,MAAc;QAPjB,YAAO,GAAY;YAC3B,WAAW,EAAE,aAAa;YAC1B,UAAU,EAAE,YAAY;SACxB,CAAC;QAEF,YAAO,GAAY,OAAO,CAAC;QAG1B,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QAC5C,MAAM,EAAC,UAAU,EAAE,aAAa,EAAC,GAAG,MAAM,CAAC,YAAY,CAAC,MAAiC,IAAI,EAAE,CAAC;QAChG,IAAI,UAAU,EAAE;YACf,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;SACrC;QAED,IAAI,aAAa,EAAE;YAClB,IAAI,CAAC,OAAO,CAAC,aAAa,GAAG,aAAa,CAAC;SAC3C;IACF,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrF,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAEjG,MAAM,IAAI,GAAG,mBAAmB,SAAS,MAAM,YAAY,eAAe,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACrG,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACzE,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC5C,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;;AAnCM,mBAAM,GAAW;IACvB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACX,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC5B,aAAa,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;KAC/B;CACD,AANY,CAMX;SAPU,YAAY"}
@@ -1,11 +0,0 @@
1
- import type { DoculaPlugin, Options, Schema, Runtime } from '../docula-plugin.js';
2
- import type { Config } from '../config.js';
3
- export declare class SitemapPlugin implements DoculaPlugin {
4
- static schema: Schema;
5
- readonly options: Options;
6
- runtime: Runtime;
7
- private readonly eleventy;
8
- constructor(config: Config);
9
- execute(): Promise<void>;
10
- }
11
- //# sourceMappingURL=sitemap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../../src/plugins/sitemap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAGzC,qBAAa,aAAc,YAAW,YAAY;IACjD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;IAE3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAIvB;IAEF,OAAO,EAAE,OAAO,CAAW;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;gBAExB,MAAM,EAAE,MAAM;IAQpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAS9B"}
@@ -1,27 +0,0 @@
1
- import fs from 'fs-extra';
2
- import { Eleventy } from '../eleventy.js';
3
- class SitemapPlugin {
4
- constructor(config) {
5
- this.options = {
6
- siteUrl: '',
7
- outputFile: 'sitemap.xml',
8
- outputPath: '',
9
- };
10
- this.runtime = 'after';
11
- this.eleventy = new Eleventy(config);
12
- this.options.outputPath = config.outputPath;
13
- const { siteUrl } = config;
14
- this.options.siteUrl = siteUrl;
15
- }
16
- async execute() {
17
- const jsonContent = await this.eleventy.toJSON();
18
- const content = `<?xml version="1.0" encoding="utf-8"?>
19
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
20
- ${jsonContent.map(item => (`<url><loc>${this.options.siteUrl}${item.url}</loc></url>`)).join('')}
21
- </urlset>`;
22
- fs.writeFileSync(`${this.options.outputPath}/${this.options.outputFile}`, content);
23
- }
24
- }
25
- SitemapPlugin.schema = {};
26
- export { SitemapPlugin };
27
- //# sourceMappingURL=sitemap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sitemap.js","sourceRoot":"","sources":["../../src/plugins/sitemap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAG1B,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAExC,MAAa,aAAa;IAYzB,YAAY,MAAc;QATjB,YAAO,GAAY;YAC3B,OAAO,EAAE,EAAE;YACX,UAAU,EAAE,aAAa;YACzB,UAAU,EAAE,EAAE;SACd,CAAC;QAEF,YAAO,GAAY,OAAO,CAAC;QAI1B,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QAC5C,MAAM,EAAC,OAAO,EAAC,GAAG,MAAM,CAAC;QAEzB,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACjD,MAAM,OAAO,GAAG;;QAEV,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,aAAa,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;cACxF,CAAC;QAEb,EAAE,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;;AA3BM,oBAAM,GAAW,EAAE,AAAb,CAAc;SADf,aAAa"}
package/dist/schemas.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import { type Plugins } from './types/config.js';
2
- type Property = Record<string, string | string[]>;
3
- type PluginsType = {
4
- type: string;
5
- items: {
6
- type: string;
7
- enum: Plugins;
8
- };
9
- };
10
- export type ConfigSchema = {
11
- type: 'object';
12
- additionalProperties: boolean;
13
- properties: {
14
- [key: string]: Property | PluginsType;
15
- plugins: PluginsType;
16
- };
17
- required: string[];
18
- };
19
- export declare const jsonConfigSchema: ConfigSchema;
20
- export {};
21
- //# sourceMappingURL=schemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAE/C,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAElD,KAAK,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,OAAO,CAAC;KACd,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,oBAAoB,EAAE,OAAO,CAAC;IAC9B,UAAU,EAAE;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC;QACtC,OAAO,EAAE,WAAW,CAAC;KACrB,CAAC;IACF,QAAQ,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,YAsB9B,CAAC"}
package/dist/schemas.js DELETED
@@ -1,25 +0,0 @@
1
- import DoculaPlugins from './plugins/index.js';
2
- export const jsonConfigSchema = {
3
- type: 'object',
4
- additionalProperties: false,
5
- properties: {
6
- originPath: { type: 'string' },
7
- outputPath: { type: 'string' },
8
- dataPath: { type: 'string' },
9
- templatePath: { type: 'string' },
10
- searchEngine: { type: 'string', enum: ['algolia', 'pagefind'] },
11
- plugins: {
12
- type: 'array',
13
- items: {
14
- type: 'string',
15
- enum: Object.keys(DoculaPlugins),
16
- },
17
- },
18
- imagesPath: { type: 'string' },
19
- assetsPath: { type: 'string' },
20
- siteUrl: { type: 'string' },
21
- siteType: { type: 'string', enum: ['landing', 'multi page'] },
22
- },
23
- required: [],
24
- };
25
- //# sourceMappingURL=schemas.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAuB/C,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC7C,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACX,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC5B,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC5B,QAAQ,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC1B,YAAY,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC9B,YAAY,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC,EAAC;QAC7D,OAAO,EAAE;YACR,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAY;aAC3C;SACD;QACD,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC5B,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC5B,OAAO,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACzB,QAAQ,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC,EAAC;KAC3D;IACD,QAAQ,EAAE,EAAE;CACZ,CAAC"}
@@ -1,20 +0,0 @@
1
- /// <reference types="jest" />
2
- export declare const getGithubInfo: jest.Mock<{
3
- author: string;
4
- repo: string;
5
- }, [], any>;
6
- export declare const validateUrl: jest.Mock<boolean, [], any>;
7
- export declare const getSiteUrl: jest.Mock<string, [], any>;
8
- export declare const getUserPlugins: jest.Mock<{
9
- plugins: string[];
10
- }, [], any>;
11
- export declare const setPlugins: jest.Mock<{
12
- siteUrl: string;
13
- searchEngine: string;
14
- plugins: string[];
15
- github: {
16
- author: string;
17
- repo: string;
18
- };
19
- }, [], any>;
20
- //# sourceMappingURL=inquirer-prompt.d.ts.map